@@ -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 |
@@ -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' : '', '> ', $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) |
@@ -51,30 +51,33 @@ discard block |
||
| 51 | 51 | $ignored_members = explode(',', $row['pm_ignore_list']); |
| 52 | 52 | |
| 53 | 53 | // If the user is in group 1 anywhere, they can see everything anyway. |
| 54 | - if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) |
|
| 55 | - $author = $row['id_member']; |
|
| 54 | + if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) { |
|
| 55 | + $author = $row['id_member']; |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | $smcFunc['db_free_result']($request); |
| 58 | - } |
|
| 59 | - else |
|
| 59 | + } else |
|
| 60 | 60 | { |
| 61 | 61 | // This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id. |
| 62 | 62 | $hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id'])); |
| 63 | - foreach ($hook_results as $result) |
|
| 64 | - if (!empty($result)) |
|
| 63 | + foreach ($hook_results as $result) { |
|
| 64 | + if (!empty($result)) |
|
| 65 | 65 | { |
| 66 | 66 | $author = $result; |
| 67 | + } |
|
| 67 | 68 | break; |
| 68 | 69 | } |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | // If we didn't have a member... leave. |
| 72 | - if (empty($author)) |
|
| 73 | - return true; |
|
| 73 | + if (empty($author)) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // If the person who sent the notification is the person whose content it is, do nothing. |
| 76 | - if ($author == $this->_details['sender_id']) |
|
| 77 | - return true; |
|
| 78 | + if ($author == $this->_details['sender_id']) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | // If the person who sent the notification is on this person's ignore list, do nothing. |
| 80 | 83 | if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) { |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | // As a result, the value should really just be non empty. |
| 89 | 92 | |
| 90 | 93 | // Check the value. If no value or it's empty, they didn't want alerts, oh well. |
| 91 | - if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) |
|
| 92 | - return true; |
|
| 94 | + if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | // Don't spam the alerts: if there is an existing unread alert of the |
| 95 | 99 | // requested type for the target user from the sender, don't make a new one. |
@@ -109,8 +113,9 @@ discard block |
||
| 109 | 113 | ) |
| 110 | 114 | ); |
| 111 | 115 | |
| 112 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 113 | - return true; |
|
| 116 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 114 | 119 | $smcFunc['db_free_result']($request); |
| 115 | 120 | |
| 116 | 121 | // Issue, update, move on. |
@@ -670,7 +670,7 @@ |
||
| 670 | 670 | // Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified! |
| 671 | 671 | // Because we insert into it through AJAX and we don't want to stop themers moving it around if they so wish so they can put it where they want it. |
| 672 | 672 | echo ' |
| 673 | - <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
|
| 673 | + <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '', '" id="modified_', $message['id'], '">'; |
|
| 674 | 674 | |
| 675 | 675 | if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
| 676 | 676 | echo |
@@ -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>'; |
@@ -253,8 +266,9 @@ discard block |
||
| 253 | 266 | $context['removableMessageIDs'] = array(); |
| 254 | 267 | |
| 255 | 268 | // Get all the messages... |
| 256 | - while ($message = $context['get_message']()) |
|
| 257 | - template_single_post($message); |
|
| 269 | + while ($message = $context['get_message']()) { |
|
| 270 | + template_single_post($message); |
|
| 271 | + } |
|
| 258 | 272 | |
| 259 | 273 | echo ' |
| 260 | 274 | </form> |
@@ -292,8 +306,9 @@ discard block |
||
| 292 | 306 | <div id="display_jump_to"> </div>'; |
| 293 | 307 | |
| 294 | 308 | // Show quickreply |
| 295 | - if ($context['can_reply']) |
|
| 296 | - template_quickreply(); |
|
| 309 | + if ($context['can_reply']) { |
|
| 310 | + template_quickreply(); |
|
| 311 | + } |
|
| 297 | 312 | |
| 298 | 313 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 299 | 314 | echo ' |
@@ -306,8 +321,8 @@ discard block |
||
| 306 | 321 | </div>'; |
| 307 | 322 | |
| 308 | 323 | // Show the moderation button & pop only if user can moderate |
| 309 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 310 | - echo ' |
|
| 324 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 325 | + echo ' |
|
| 311 | 326 | <div id="mobile_moderation" class="popup_container"> |
| 312 | 327 | <div class="popup_window description"> |
| 313 | 328 | <div class="popup_heading">', $txt['mobile_moderation'], ' |
@@ -317,6 +332,7 @@ discard block |
||
| 317 | 332 | </div> |
| 318 | 333 | </div> |
| 319 | 334 | </div>'; |
| 335 | + } |
|
| 320 | 336 | |
| 321 | 337 | echo ' |
| 322 | 338 | <script>'; |
@@ -440,9 +456,10 @@ discard block |
||
| 440 | 456 | }); |
| 441 | 457 | }'; |
| 442 | 458 | |
| 443 | - if (!empty($context['ignoredMsgs'])) |
|
| 444 | - echo ' |
|
| 459 | + if (!empty($context['ignoredMsgs'])) { |
|
| 460 | + echo ' |
|
| 445 | 461 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 462 | + } |
|
| 446 | 463 | |
| 447 | 464 | echo ' |
| 448 | 465 | </script>'; |
@@ -459,8 +476,9 @@ discard block |
||
| 459 | 476 | |
| 460 | 477 | $ignoring = false; |
| 461 | 478 | |
| 462 | - if ($message['can_remove']) |
|
| 463 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 479 | + if ($message['can_remove']) { |
|
| 480 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 481 | + } |
|
| 464 | 482 | |
| 465 | 483 | // Are we ignoring this message? |
| 466 | 484 | if (!empty($message['is_ignored'])) |
@@ -486,9 +504,10 @@ discard block |
||
| 486 | 504 | <div class="custom_fields_above_member"> |
| 487 | 505 | <ul class="nolist">'; |
| 488 | 506 | |
| 489 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 490 | - echo ' |
|
| 507 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 508 | + echo ' |
|
| 491 | 509 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 510 | + } |
|
| 492 | 511 | |
| 493 | 512 | echo ' |
| 494 | 513 | </ul> |
@@ -499,9 +518,10 @@ discard block |
||
| 499 | 518 | <h4>'; |
| 500 | 519 | |
| 501 | 520 | // Show online and offline buttons? |
| 502 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 503 | - echo ' |
|
| 521 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 522 | + echo ' |
|
| 504 | 523 | ', $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>' : ''; |
| 524 | + } |
|
| 505 | 525 | |
| 506 | 526 | |
| 507 | 527 | // Show a link to the member's profile. |
@@ -514,51 +534,59 @@ discard block |
||
| 514 | 534 | |
| 515 | 535 | |
| 516 | 536 | // Show the user's avatar. |
| 517 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 518 | - echo ' |
|
| 537 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 538 | + echo ' |
|
| 519 | 539 | <li class="avatar"> |
| 520 | 540 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 521 | 541 | </li>'; |
| 542 | + } |
|
| 522 | 543 | |
| 523 | 544 | // Are there any custom fields below the avatar? |
| 524 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 525 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 545 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 546 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 526 | 547 | echo ' |
| 527 | 548 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 549 | + } |
|
| 528 | 550 | |
| 529 | 551 | // Show the post group icons, but not for guests. |
| 530 | - if (!$message['member']['is_guest']) |
|
| 531 | - echo ' |
|
| 552 | + if (!$message['member']['is_guest']) { |
|
| 553 | + echo ' |
|
| 532 | 554 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 555 | + } |
|
| 533 | 556 | |
| 534 | 557 | // Show the member's primary group (like 'Administrator') if they have one. |
| 535 | - if (!empty($message['member']['group'])) |
|
| 536 | - echo ' |
|
| 558 | + if (!empty($message['member']['group'])) { |
|
| 559 | + echo ' |
|
| 537 | 560 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 561 | + } |
|
| 538 | 562 | |
| 539 | 563 | // Show the member's custom title, if they have one. |
| 540 | - if (!empty($message['member']['title'])) |
|
| 541 | - echo ' |
|
| 564 | + if (!empty($message['member']['title'])) { |
|
| 565 | + echo ' |
|
| 542 | 566 | <li class="title">', $message['member']['title'], '</li>'; |
| 567 | + } |
|
| 543 | 568 | |
| 544 | 569 | // Don't show these things for guests. |
| 545 | 570 | if (!$message['member']['is_guest']) |
| 546 | 571 | { |
| 547 | 572 | |
| 548 | 573 | // 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. |
| 549 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 550 | - echo ' |
|
| 574 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 575 | + echo ' |
|
| 551 | 576 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 577 | + } |
|
| 552 | 578 | |
| 553 | 579 | // Show how many posts they have made. |
| 554 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 555 | - echo ' |
|
| 580 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 581 | + echo ' |
|
| 556 | 582 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 583 | + } |
|
| 557 | 584 | |
| 558 | 585 | // Show their personal text? |
| 559 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 560 | - echo ' |
|
| 586 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 587 | + echo ' |
|
| 561 | 588 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 589 | + } |
|
| 562 | 590 | |
| 563 | 591 | // Any custom fields to show as icons? |
| 564 | 592 | if (!empty($message['custom_fields']['icons'])) |
@@ -567,9 +595,10 @@ discard block |
||
| 567 | 595 | <li class="im_icons"> |
| 568 | 596 | <ol>'; |
| 569 | 597 | |
| 570 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 571 | - echo ' |
|
| 598 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 599 | + echo ' |
|
| 572 | 600 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 601 | + } |
|
| 573 | 602 | |
| 574 | 603 | echo ' |
| 575 | 604 | </ol> |
@@ -584,19 +613,22 @@ discard block |
||
| 584 | 613 | <ol class="profile_icons">'; |
| 585 | 614 | |
| 586 | 615 | // Don't show an icon if they haven't specified a website. |
| 587 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 588 | - echo ' |
|
| 616 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 617 | + echo ' |
|
| 589 | 618 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 619 | + } |
|
| 590 | 620 | |
| 591 | 621 | // Since we know this person isn't a guest, you *can* message them. |
| 592 | - if ($context['can_send_pm']) |
|
| 593 | - echo ' |
|
| 622 | + if ($context['can_send_pm']) { |
|
| 623 | + echo ' |
|
| 594 | 624 | <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>'; |
| 625 | + } |
|
| 595 | 626 | |
| 596 | 627 | // Show the email if necessary |
| 597 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 598 | - echo ' |
|
| 628 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 629 | + echo ' |
|
| 599 | 630 | <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>'; |
| 631 | + } |
|
| 600 | 632 | |
| 601 | 633 | echo ' |
| 602 | 634 | </ol> |
@@ -604,48 +636,56 @@ discard block |
||
| 604 | 636 | } |
| 605 | 637 | |
| 606 | 638 | // Any custom fields for standard placement? |
| 607 | - if (!empty($message['custom_fields']['standard'])) |
|
| 608 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 639 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 640 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 609 | 641 | echo ' |
| 610 | 642 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 643 | + } |
|
| 611 | 644 | |
| 612 | 645 | } |
| 613 | 646 | // Otherwise, show the guest's email. |
| 614 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 615 | - echo ' |
|
| 647 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 648 | + echo ' |
|
| 616 | 649 | <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>'; |
| 650 | + } |
|
| 617 | 651 | |
| 618 | 652 | // Show the IP to this user for this post - because you can moderate? |
| 619 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 620 | - echo ' |
|
| 653 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 654 | + echo ' |
|
| 621 | 655 | <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>'; |
| 656 | + } |
|
| 622 | 657 | |
| 623 | 658 | // Or, should we show it because this is you? |
| 624 | - elseif ($message['can_see_ip']) |
|
| 625 | - echo ' |
|
| 659 | + elseif ($message['can_see_ip']) { |
|
| 660 | + echo ' |
|
| 626 | 661 | <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>'; |
| 662 | + } |
|
| 627 | 663 | |
| 628 | 664 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 629 | - elseif (!$context['user']['is_guest']) |
|
| 630 | - echo ' |
|
| 665 | + elseif (!$context['user']['is_guest']) { |
|
| 666 | + echo ' |
|
| 631 | 667 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
| 668 | + } |
|
| 632 | 669 | |
| 633 | 670 | // Otherwise, you see NOTHING! |
| 634 | - else |
|
| 635 | - echo ' |
|
| 671 | + else { |
|
| 672 | + echo ' |
|
| 636 | 673 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 674 | + } |
|
| 637 | 675 | |
| 638 | 676 | // Are we showing the warning status? |
| 639 | 677 | // Don't show these things for guests. |
| 640 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 641 | - echo ' |
|
| 678 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 679 | + echo ' |
|
| 642 | 680 | <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>'; |
| 681 | + } |
|
| 643 | 682 | |
| 644 | 683 | // Are there any custom fields to show at the bottom of the poster info? |
| 645 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 646 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 684 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 685 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 647 | 686 | echo ' |
| 648 | 687 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 688 | + } |
|
| 649 | 689 | |
| 650 | 690 | // Poster info ends. |
| 651 | 691 | echo ' |
@@ -674,9 +714,10 @@ discard block |
||
| 674 | 714 | echo ' |
| 675 | 715 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
| 676 | 716 | |
| 677 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 678 | - echo |
|
| 717 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 718 | + echo |
|
| 679 | 719 | $message['modified']['last_edit_text']; |
| 720 | + } |
|
| 680 | 721 | |
| 681 | 722 | echo ' |
| 682 | 723 | </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($modSettings['enable_likes']) || $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($modSettings['enable_likes']) || $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($modSettings['enable_likes']) || $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($modSettings['enable_likes']) || $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']++, '" 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> |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | |
| 119 | 119 | // Right, image not cached? Simply redirect, then. |
| 120 | 120 | if (!$response) |
| 121 | - redirectexit($request); |
|
| 121 | + redirectexit($request); |
|
| 122 | 122 | |
| 123 | 123 | // Make sure we're serving an image |
| 124 | 124 | $contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : ''); |
@@ -63,26 +63,31 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function checkRequest() |
| 65 | 65 | { |
| 66 | - if (!$this->enabled) |
|
| 67 | - return false; |
|
| 66 | + if (!$this->enabled) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | // Try to create the image cache directory if it doesn't exist |
| 70 | - if (!file_exists($this->cache)) |
|
| 71 | - if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
| 71 | + if (!file_exists($this->cache)) { |
|
| 72 | + if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
| 72 | 73 | return false; |
| 74 | + } |
|
| 73 | 75 | |
| 74 | - if (empty($_GET['hash']) || empty($_GET['request'])) |
|
| 75 | - return false; |
|
| 76 | + if (empty($_GET['hash']) || empty($_GET['request'])) { |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 76 | 79 | |
| 77 | 80 | $hash = $_GET['hash']; |
| 78 | 81 | $request = $_GET['request']; |
| 79 | 82 | |
| 80 | - if (md5($request . $this->secret) != $hash) |
|
| 81 | - return false; |
|
| 83 | + if (md5($request . $this->secret) != $hash) { |
|
| 84 | + return false; |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | // Attempt to cache the request if it doesn't exist |
| 84 | - if (!$this->isCached($request)) |
|
| 85 | - return $this->cacheImage($request); |
|
| 88 | + if (!$this->isCached($request)) { |
|
| 89 | + return $this->cacheImage($request); |
|
| 90 | + } |
|
| 86 | 91 | |
| 87 | 92 | return true; |
| 88 | 93 | } |
@@ -111,19 +116,22 @@ discard block |
||
| 111 | 116 | if (!$cached || time() - $cached['time'] > (5 * 86400)) |
| 112 | 117 | { |
| 113 | 118 | @unlink($cached_file); |
| 114 | - if ($this->checkRequest()) |
|
| 115 | - $this->serve(); |
|
| 119 | + if ($this->checkRequest()) { |
|
| 120 | + $this->serve(); |
|
| 121 | + } |
|
| 116 | 122 | redirectexit($request); |
| 117 | 123 | } |
| 118 | 124 | |
| 119 | 125 | // Right, image not cached? Simply redirect, then. |
| 120 | - if (!$response) |
|
| 121 | - redirectexit($request); |
|
| 126 | + if (!$response) { |
|
| 127 | + redirectexit($request); |
|
| 128 | + } |
|
| 122 | 129 | |
| 123 | 130 | // Make sure we're serving an image |
| 124 | 131 | $contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : ''); |
| 125 | - if ($contentParts[0] != 'image') |
|
| 126 | - exit; |
|
| 132 | + if ($contentParts[0] != 'image') { |
|
| 133 | + exit; |
|
| 134 | + } |
|
| 127 | 135 | |
| 128 | 136 | header('Content-type: ' . $cached['content_type']); |
| 129 | 137 | header('Content-length: ' . $cached['size']); |
@@ -170,8 +178,9 @@ discard block |
||
| 170 | 178 | $responseCode = $request->result('code'); |
| 171 | 179 | $response = $request->result(); |
| 172 | 180 | |
| 173 | - if (empty($response)) |
|
| 174 | - return false; |
|
| 181 | + if (empty($response)) { |
|
| 182 | + return false; |
|
| 183 | + } |
|
| 175 | 184 | |
| 176 | 185 | if ($responseCode != 200) { |
| 177 | 186 | return false; |
@@ -181,12 +190,14 @@ discard block |
||
| 181 | 190 | |
| 182 | 191 | // Make sure the url is returning an image |
| 183 | 192 | $contentParts = explode('/', !empty($headers['content-type']) ? $headers['content-type'] : ''); |
| 184 | - if ($contentParts[0] != 'image') |
|
| 185 | - return false; |
|
| 193 | + if ($contentParts[0] != 'image') { |
|
| 194 | + return false; |
|
| 195 | + } |
|
| 186 | 196 | |
| 187 | 197 | // Validate the filesize |
| 188 | - if ($response['size'] > ($this->maxSize * 1024)) |
|
| 189 | - return false; |
|
| 198 | + if ($response['size'] > ($this->maxSize * 1024)) { |
|
| 199 | + return false; |
|
| 200 | + } |
|
| 190 | 201 | |
| 191 | 202 | return file_put_contents($dest, json_encode(array( |
| 192 | 203 | 'content_type' => $headers['content-type'], |