@@ -945,7 +945,7 @@ |
||
945 | 945 | } |
946 | 946 | |
947 | 947 | echo isset($config_var['postinput']) ? ' |
948 | - ' . $config_var['postinput'] : '',' |
|
948 | + ' . $config_var['postinput'] : '', ' |
|
949 | 949 | </dd>'; |
950 | 950 | } |
951 | 951 | } |
@@ -64,9 +64,10 @@ discard block |
||
64 | 64 | <strong>', $txt['administrators'], ':</strong> |
65 | 65 | ', implode(', ', $context['administrators']); |
66 | 66 | // If we have lots of admins... don't show them all. |
67 | - if (!empty($context['more_admins_link'])) |
|
68 | - echo ' |
|
67 | + if (!empty($context['more_admins_link'])) { |
|
68 | + echo ' |
|
69 | 69 | (', $context['more_admins_link'], ')'; |
70 | + } |
|
70 | 71 | |
71 | 72 | echo ' |
72 | 73 | </div><!-- #version_details --> |
@@ -83,17 +84,19 @@ discard block |
||
83 | 84 | foreach ($area['areas'] as $item_id => $item) |
84 | 85 | { |
85 | 86 | // No point showing the 'home' page here, we're already on it! |
86 | - if ($area_id == 'forum' && $item_id == 'index') |
|
87 | - continue; |
|
87 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
88 | + continue; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
90 | 92 | |
91 | - if (!empty($item['icon_file'])) |
|
92 | - echo ' |
|
93 | + if (!empty($item['icon_file'])) { |
|
94 | + echo ' |
|
93 | 95 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
94 | - else |
|
95 | - echo ' |
|
96 | + } else { |
|
97 | + echo ' |
|
96 | 98 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
99 | + } |
|
97 | 100 | } |
98 | 101 | |
99 | 102 | echo ' |
@@ -104,10 +107,11 @@ discard block |
||
104 | 107 | </div><!-- #admincenter -->'; |
105 | 108 | |
106 | 109 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
107 | - if (empty($modSettings['disable_smf_js'])) |
|
108 | - echo ' |
|
110 | + if (empty($modSettings['disable_smf_js'])) { |
|
111 | + echo ' |
|
109 | 112 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
110 | 113 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
114 | + } |
|
111 | 115 | |
112 | 116 | // This sets the announcements and current versions themselves ;). |
113 | 117 | echo ' |
@@ -186,9 +190,10 @@ discard block |
||
186 | 190 | <em>', $version['version'], '</em>'; |
187 | 191 | |
188 | 192 | // more details for this item, show them a link |
189 | - if ($context['can_admin'] && isset($version['more'])) |
|
190 | - echo |
|
193 | + if ($context['can_admin'] && isset($version['more'])) { |
|
194 | + echo |
|
191 | 195 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
196 | + } |
|
192 | 197 | echo ' |
193 | 198 | <br>'; |
194 | 199 | } |
@@ -219,21 +224,23 @@ discard block |
||
219 | 224 | |
220 | 225 | foreach ($context['credits'] as $section) |
221 | 226 | { |
222 | - if (isset($section['pretext'])) |
|
223 | - echo ' |
|
227 | + if (isset($section['pretext'])) { |
|
228 | + echo ' |
|
224 | 229 | <p>', $section['pretext'], '</p> |
225 | 230 | <hr>'; |
231 | + } |
|
226 | 232 | |
227 | 233 | echo ' |
228 | 234 | <dl>'; |
229 | 235 | |
230 | 236 | foreach ($section['groups'] as $group) |
231 | 237 | { |
232 | - if (isset($group['title'])) |
|
233 | - echo ' |
|
238 | + if (isset($group['title'])) { |
|
239 | + echo ' |
|
234 | 240 | <dt> |
235 | 241 | <strong>', $group['title'], ':</strong> |
236 | 242 | </dt>'; |
243 | + } |
|
237 | 244 | |
238 | 245 | echo ' |
239 | 246 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -242,10 +249,11 @@ discard block |
||
242 | 249 | echo ' |
243 | 250 | </dl>'; |
244 | 251 | |
245 | - if (isset($section['posttext'])) |
|
246 | - echo ' |
|
252 | + if (isset($section['posttext'])) { |
|
253 | + echo ' |
|
247 | 254 | <hr> |
248 | 255 | <p>', $section['posttext'], '</p>'; |
256 | + } |
|
249 | 257 | } |
250 | 258 | |
251 | 259 | echo ' |
@@ -261,9 +269,10 @@ discard block |
||
261 | 269 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
262 | 270 | |
263 | 271 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
264 | - foreach ($context['current_versions'] as $variable => $version) |
|
265 | - echo ' |
|
272 | + foreach ($context['current_versions'] as $variable => $version) { |
|
273 | + echo ' |
|
266 | 274 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
275 | + } |
|
267 | 276 | |
268 | 277 | // Now we just have to include the script and wait ;). |
269 | 278 | echo ' |
@@ -360,8 +369,8 @@ discard block |
||
360 | 369 | <tbody>'; |
361 | 370 | |
362 | 371 | // Loop through every source file displaying its version - using javascript. |
363 | - foreach ($context['file_versions'] as $filename => $version) |
|
364 | - echo ' |
|
372 | + foreach ($context['file_versions'] as $filename => $version) { |
|
373 | + echo ' |
|
365 | 374 | <tr class="windowbg"> |
366 | 375 | <td class="half_table"> |
367 | 376 | ', $filename, ' |
@@ -373,6 +382,7 @@ discard block |
||
373 | 382 | <em id="currentSources', $filename, '">??</em> |
374 | 383 | </td> |
375 | 384 | </tr>'; |
385 | + } |
|
376 | 386 | |
377 | 387 | // Default template files. |
378 | 388 | echo ' |
@@ -398,8 +408,8 @@ discard block |
||
398 | 408 | <table id="Default" class="table_grid"> |
399 | 409 | <tbody>'; |
400 | 410 | |
401 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
402 | - echo ' |
|
411 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
412 | + echo ' |
|
403 | 413 | <tr class="windowbg"> |
404 | 414 | <td class="half_table"> |
405 | 415 | ', $filename, ' |
@@ -411,6 +421,7 @@ discard block |
||
411 | 421 | <em id="currentDefault', $filename, '">??</em> |
412 | 422 | </td> |
413 | 423 | </tr>'; |
424 | + } |
|
414 | 425 | |
415 | 426 | // Now the language files... |
416 | 427 | echo ' |
@@ -438,8 +449,8 @@ discard block |
||
438 | 449 | |
439 | 450 | foreach ($context['default_language_versions'] as $language => $files) |
440 | 451 | { |
441 | - foreach ($files as $filename => $version) |
|
442 | - echo ' |
|
452 | + foreach ($files as $filename => $version) { |
|
453 | + echo ' |
|
443 | 454 | <tr class="windowbg"> |
444 | 455 | <td class="half_table"> |
445 | 456 | ', $filename, '.<em>', $language, '</em>.php |
@@ -451,6 +462,7 @@ discard block |
||
451 | 462 | <em id="current', $filename, '.', $language, '">??</em> |
452 | 463 | </td> |
453 | 464 | </tr>'; |
465 | + } |
|
454 | 466 | } |
455 | 467 | |
456 | 468 | echo ' |
@@ -480,8 +492,8 @@ discard block |
||
480 | 492 | <table id="Templates" class="table_grid"> |
481 | 493 | <tbody>'; |
482 | 494 | |
483 | - foreach ($context['template_versions'] as $filename => $version) |
|
484 | - echo ' |
|
495 | + foreach ($context['template_versions'] as $filename => $version) { |
|
496 | + echo ' |
|
485 | 497 | <tr class="windowbg"> |
486 | 498 | <td class="half_table"> |
487 | 499 | ', $filename, ' |
@@ -493,6 +505,7 @@ discard block |
||
493 | 505 | <em id="currentTemplates', $filename, '">??</em> |
494 | 506 | </td> |
495 | 507 | </tr>'; |
508 | + } |
|
496 | 509 | |
497 | 510 | echo ' |
498 | 511 | </tbody> |
@@ -522,8 +535,8 @@ discard block |
||
522 | 535 | <table id="Tasks" class="table_grid"> |
523 | 536 | <tbody>'; |
524 | 537 | |
525 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
526 | - echo ' |
|
538 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
539 | + echo ' |
|
527 | 540 | <tr class="windowbg"> |
528 | 541 | <td class="half_table"> |
529 | 542 | ', $filename, ' |
@@ -535,6 +548,7 @@ discard block |
||
535 | 548 | <em id="currentTasks', $filename, '">??</em> |
536 | 549 | </td> |
537 | 550 | </tr>'; |
551 | + } |
|
538 | 552 | |
539 | 553 | echo ' |
540 | 554 | </tbody> |
@@ -576,9 +590,10 @@ discard block |
||
576 | 590 | { |
577 | 591 | global $context, $scripturl, $txt, $modSettings; |
578 | 592 | |
579 | - if (!empty($context['saved_successful'])) |
|
580 | - echo ' |
|
593 | + if (!empty($context['saved_successful'])) { |
|
594 | + echo ' |
|
581 | 595 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
596 | + } |
|
582 | 597 | |
583 | 598 | // First section is for adding/removing words from the censored list. |
584 | 599 | echo ' |
@@ -593,11 +608,12 @@ discard block |
||
593 | 608 | <p>', $txt['admin_censored_where'], '</p>'; |
594 | 609 | |
595 | 610 | // Show text boxes for censoring [bad ] => [good ]. |
596 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
597 | - echo ' |
|
611 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
612 | + echo ' |
|
598 | 613 | <div class="block"> |
599 | 614 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
600 | 615 | </div>'; |
616 | + } |
|
601 | 617 | |
602 | 618 | // Now provide a way to censor more words. |
603 | 619 | echo ' |
@@ -672,19 +688,21 @@ discard block |
||
672 | 688 | <div class="windowbg2 noup"> |
673 | 689 | ', $txt['not_done_reason']; |
674 | 690 | |
675 | - if (!empty($context['continue_percent'])) |
|
676 | - echo ' |
|
691 | + if (!empty($context['continue_percent'])) { |
|
692 | + echo ' |
|
677 | 693 | <div class="progress_bar"> |
678 | 694 | <div class="full_bar">', $context['continue_percent'], '%</div> |
679 | 695 | <div class="green_percent" style="width: ', $context['continue_percent'], '%;"> </div> |
680 | 696 | </div>'; |
697 | + } |
|
681 | 698 | |
682 | - if (!empty($context['substep_enabled'])) |
|
683 | - echo ' |
|
699 | + if (!empty($context['substep_enabled'])) { |
|
700 | + echo ' |
|
684 | 701 | <div class="progress_bar"> |
685 | 702 | <div class="full_bar">', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</div> |
686 | 703 | <div class="blue_percent" style="width: ', $context['substep_continue_percent'], '%;"> </div> |
687 | 704 | </div>'; |
705 | + } |
|
688 | 706 | |
689 | 707 | echo ' |
690 | 708 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
@@ -719,35 +737,40 @@ discard block |
||
719 | 737 | { |
720 | 738 | global $context, $txt, $scripturl; |
721 | 739 | |
722 | - if (!empty($context['saved_successful'])) |
|
723 | - echo ' |
|
740 | + if (!empty($context['saved_successful'])) { |
|
741 | + echo ' |
|
724 | 742 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
725 | - elseif (!empty($context['saved_failed'])) |
|
726 | - echo ' |
|
743 | + } elseif (!empty($context['saved_failed'])) { |
|
744 | + echo ' |
|
727 | 745 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
746 | + } |
|
728 | 747 | |
729 | - if (!empty($context['settings_pre_javascript'])) |
|
730 | - echo ' |
|
748 | + if (!empty($context['settings_pre_javascript'])) { |
|
749 | + echo ' |
|
731 | 750 | <script>', $context['settings_pre_javascript'], '</script>'; |
751 | + } |
|
732 | 752 | |
733 | - if (!empty($context['settings_insert_above'])) |
|
734 | - echo $context['settings_insert_above']; |
|
753 | + if (!empty($context['settings_insert_above'])) { |
|
754 | + echo $context['settings_insert_above']; |
|
755 | + } |
|
735 | 756 | |
736 | 757 | echo ' |
737 | 758 | <div id="admincenter"> |
738 | 759 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
739 | 760 | |
740 | 761 | // Is there a custom title? |
741 | - if (isset($context['settings_title'])) |
|
742 | - echo ' |
|
762 | + if (isset($context['settings_title'])) { |
|
763 | + echo ' |
|
743 | 764 | <div class="cat_bar"> |
744 | 765 | <h3 class="catbg">', $context['settings_title'], '</h3> |
745 | 766 | </div>'; |
767 | + } |
|
746 | 768 | |
747 | 769 | // Have we got a message to display? |
748 | - if (!empty($context['settings_message'])) |
|
749 | - echo ' |
|
770 | + if (!empty($context['settings_message'])) { |
|
771 | + echo ' |
|
750 | 772 | <div class="information">', $context['settings_message'], '</div>'; |
773 | + } |
|
751 | 774 | |
752 | 775 | // Now actually loop through all the variables. |
753 | 776 | $is_open = false; |
@@ -800,8 +823,9 @@ discard block |
||
800 | 823 | // Hang about? Are you pulling my leg - a callback?! |
801 | 824 | if (is_array($config_var) && $config_var['type'] == 'callback') |
802 | 825 | { |
803 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
804 | - call_user_func('template_callback_' . $config_var['name']); |
|
826 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
827 | + call_user_func('template_callback_' . $config_var['name']); |
|
828 | + } |
|
805 | 829 | |
806 | 830 | continue; |
807 | 831 | } |
@@ -831,9 +855,10 @@ discard block |
||
831 | 855 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
832 | 856 | |
833 | 857 | // Show the [?] button. |
834 | - if ($config_var['help']) |
|
835 | - echo ' |
|
858 | + if ($config_var['help']) { |
|
859 | + echo ' |
|
836 | 860 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
861 | + } |
|
837 | 862 | |
838 | 863 | echo ' |
839 | 864 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -842,22 +867,25 @@ discard block |
||
842 | 867 | $config_var['preinput']; |
843 | 868 | |
844 | 869 | // Show a check box. |
845 | - if ($config_var['type'] == 'check') |
|
846 | - echo ' |
|
870 | + if ($config_var['type'] == 'check') { |
|
871 | + echo ' |
|
847 | 872 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">'; |
873 | + } |
|
848 | 874 | // Escape (via htmlspecialchars.) the text box. |
849 | - elseif ($config_var['type'] == 'password') |
|
850 | - echo ' |
|
875 | + elseif ($config_var['type'] == 'password') { |
|
876 | + echo ' |
|
851 | 877 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br> |
852 | 878 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
879 | + } |
|
853 | 880 | // Show a selection box. |
854 | 881 | elseif ($config_var['type'] == 'select') |
855 | 882 | { |
856 | 883 | echo ' |
857 | 884 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
858 | - foreach ($config_var['data'] as $option) |
|
859 | - echo ' |
|
885 | + foreach ($config_var['data'] as $option) { |
|
886 | + echo ' |
|
860 | 887 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
888 | + } |
|
861 | 889 | echo ' |
862 | 890 | </select>'; |
863 | 891 | } |
@@ -874,16 +902,18 @@ discard block |
||
874 | 902 | |
875 | 903 | foreach ($context['board_list'] as $id_cat => $cat) |
876 | 904 | { |
877 | - if (!$first) |
|
878 | - echo ' |
|
905 | + if (!$first) { |
|
906 | + echo ' |
|
879 | 907 | <hr>'; |
908 | + } |
|
880 | 909 | echo ' |
881 | 910 | <strong>', $cat['name'], '</strong> |
882 | 911 | <ul>'; |
883 | 912 | |
884 | - foreach ($cat['boards'] as $id_board => $brd) |
|
885 | - echo ' |
|
913 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
914 | + echo ' |
|
886 | 915 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
916 | + } |
|
887 | 917 | |
888 | 918 | echo ' |
889 | 919 | </ul>'; |
@@ -893,12 +923,14 @@ discard block |
||
893 | 923 | </fieldset>'; |
894 | 924 | } |
895 | 925 | // Text area? |
896 | - elseif ($config_var['type'] == 'large_text') |
|
897 | - echo ' |
|
926 | + elseif ($config_var['type'] == 'large_text') { |
|
927 | + echo ' |
|
898 | 928 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
929 | + } |
|
899 | 930 | // Permission group? |
900 | - elseif ($config_var['type'] == 'permissions') |
|
901 | - theme_inline_permissions($config_var['name']); |
|
931 | + elseif ($config_var['type'] == 'permissions') { |
|
932 | + theme_inline_permissions($config_var['name']); |
|
933 | + } |
|
902 | 934 | |
903 | 935 | // BBC selection? |
904 | 936 | elseif ($config_var['type'] == 'bbc') |
@@ -910,20 +942,22 @@ discard block |
||
910 | 942 | |
911 | 943 | foreach ($context['bbc_columns'] as $bbcColumn) |
912 | 944 | { |
913 | - foreach ($bbcColumn as $bbcTag) |
|
914 | - echo ' |
|
945 | + foreach ($bbcColumn as $bbcTag) { |
|
946 | + echo ' |
|
915 | 947 | <li class="list_bbc floatleft"> |
916 | 948 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
917 | 949 | </li>'; |
950 | + } |
|
918 | 951 | } |
919 | 952 | echo ' </ul> |
920 | 953 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
921 | 954 | </fieldset>'; |
922 | 955 | } |
923 | 956 | // A simple message? |
924 | - elseif ($config_var['type'] == 'var_message') |
|
925 | - echo ' |
|
957 | + elseif ($config_var['type'] == 'var_message') { |
|
958 | + echo ' |
|
926 | 959 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>'; |
960 | + } |
|
927 | 961 | // Assume it must be a text box |
928 | 962 | else |
929 | 963 | { |
@@ -948,63 +982,70 @@ discard block |
||
948 | 982 | ' . $config_var['postinput'] : '',' |
949 | 983 | </dd>'; |
950 | 984 | } |
951 | - } |
|
952 | - |
|
953 | - else |
|
985 | + } else |
|
954 | 986 | { |
955 | 987 | // Just show a separator. |
956 | - if ($config_var == '') |
|
957 | - echo ' |
|
988 | + if ($config_var == '') { |
|
989 | + echo ' |
|
958 | 990 | </dl> |
959 | 991 | <hr> |
960 | 992 | <dl class="settings">'; |
961 | - else |
|
962 | - echo ' |
|
993 | + } else { |
|
994 | + echo ' |
|
963 | 995 | <dd> |
964 | 996 | <strong>' . $config_var . '</strong> |
965 | 997 | </dd>'; |
998 | + } |
|
966 | 999 | } |
967 | 1000 | } |
968 | 1001 | |
969 | - if ($is_open) |
|
970 | - echo ' |
|
1002 | + if ($is_open) { |
|
1003 | + echo ' |
|
971 | 1004 | </dl>'; |
1005 | + } |
|
972 | 1006 | |
973 | - if (empty($context['settings_save_dont_show'])) |
|
974 | - echo ' |
|
1007 | + if (empty($context['settings_save_dont_show'])) { |
|
1008 | + echo ' |
|
975 | 1009 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">'; |
1010 | + } |
|
976 | 1011 | |
977 | - if ($is_open) |
|
978 | - echo ' |
|
1012 | + if ($is_open) { |
|
1013 | + echo ' |
|
979 | 1014 | </div><!-- .windowbg2 -->'; |
1015 | + } |
|
980 | 1016 | |
981 | 1017 | |
982 | 1018 | // At least one token has to be used! |
983 | - if (isset($context['admin-ssc_token'])) |
|
984 | - echo ' |
|
1019 | + if (isset($context['admin-ssc_token'])) { |
|
1020 | + echo ' |
|
985 | 1021 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1022 | + } |
|
986 | 1023 | |
987 | - if (isset($context['admin-dbsc_token'])) |
|
988 | - echo ' |
|
1024 | + if (isset($context['admin-dbsc_token'])) { |
|
1025 | + echo ' |
|
989 | 1026 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1027 | + } |
|
990 | 1028 | |
991 | - if (isset($context['admin-mp_token'])) |
|
992 | - echo ' |
|
1029 | + if (isset($context['admin-mp_token'])) { |
|
1030 | + echo ' |
|
993 | 1031 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1032 | + } |
|
994 | 1033 | |
995 | 1034 | echo ' |
996 | 1035 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
997 | 1036 | </form> |
998 | 1037 | </div><!-- #admincenter -->'; |
999 | 1038 | |
1000 | - if (!empty($context['settings_post_javascript'])) |
|
1001 | - echo ' |
|
1039 | + if (!empty($context['settings_post_javascript'])) { |
|
1040 | + echo ' |
|
1002 | 1041 | <script> |
1003 | 1042 | ', $context['settings_post_javascript'], ' |
1004 | 1043 | </script>'; |
1044 | + } |
|
1005 | 1045 | |
1006 | - if (!empty($context['settings_insert_below'])) |
|
1007 | - echo $context['settings_insert_below']; |
|
1046 | + if (!empty($context['settings_insert_below'])) { |
|
1047 | + echo $context['settings_insert_below']; |
|
1048 | + } |
|
1008 | 1049 | |
1009 | 1050 | // We may have added a board listing. If we did, we need to make it work. |
1010 | 1051 | addInlineJavascript(' |
@@ -1027,9 +1068,10 @@ discard block |
||
1027 | 1068 | { |
1028 | 1069 | global $context, $txt; |
1029 | 1070 | |
1030 | - if (!empty($context['saved_successful'])) |
|
1031 | - echo ' |
|
1071 | + if (!empty($context['saved_successful'])) { |
|
1072 | + echo ' |
|
1032 | 1073 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1074 | + } |
|
1033 | 1075 | |
1034 | 1076 | // Standard fields. |
1035 | 1077 | template_show_list('standard_profile_fields'); |
@@ -1062,11 +1104,12 @@ discard block |
||
1062 | 1104 | if (isset($_GET['msg'])) |
1063 | 1105 | { |
1064 | 1106 | loadLanguage('Errors'); |
1065 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1066 | - echo ' |
|
1107 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1108 | + echo ' |
|
1067 | 1109 | <div class="errorbox">', |
1068 | 1110 | $txt['custom_option_' . $_GET['msg']], ' |
1069 | 1111 | </div>'; |
1112 | + } |
|
1070 | 1113 | } |
1071 | 1114 | |
1072 | 1115 | echo ' |
@@ -1133,9 +1176,10 @@ discard block |
||
1133 | 1176 | <dd> |
1134 | 1177 | <select name="placement" id="placement">'; |
1135 | 1178 | |
1136 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1137 | - echo ' |
|
1179 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1180 | + echo ' |
|
1138 | 1181 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1182 | + } |
|
1139 | 1183 | |
1140 | 1184 | echo ' |
1141 | 1185 | </select> |
@@ -1159,9 +1203,10 @@ discard block |
||
1159 | 1203 | <dd> |
1160 | 1204 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1161 | 1205 | |
1162 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1163 | - echo ' |
|
1206 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1207 | + echo ' |
|
1164 | 1208 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1209 | + } |
|
1165 | 1210 | |
1166 | 1211 | echo ' |
1167 | 1212 | </select> |
@@ -1262,9 +1307,10 @@ discard block |
||
1262 | 1307 | </fieldset> |
1263 | 1308 | <input type="submit" name="save" value="', $txt['save'], '" class="button">'; |
1264 | 1309 | |
1265 | - if ($context['fid']) |
|
1266 | - echo ' |
|
1310 | + if ($context['fid']) { |
|
1311 | + echo ' |
|
1267 | 1312 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">'; |
1313 | + } |
|
1268 | 1314 | |
1269 | 1315 | echo ' |
1270 | 1316 | </div><!-- .windowbg2 --> |
@@ -1307,8 +1353,7 @@ discard block |
||
1307 | 1353 | { |
1308 | 1354 | echo ' |
1309 | 1355 | <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>'; |
1310 | - } |
|
1311 | - else |
|
1356 | + } else |
|
1312 | 1357 | { |
1313 | 1358 | echo ' |
1314 | 1359 | <ol class="search_results">'; |
@@ -1335,9 +1380,10 @@ discard block |
||
1335 | 1380 | <li> |
1336 | 1381 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1337 | 1382 | |
1338 | - if ($result['help']) |
|
1339 | - echo ' |
|
1383 | + if ($result['help']) { |
|
1384 | + echo ' |
|
1340 | 1385 | <p class="double_height">', $result['help'], '</p>'; |
1386 | + } |
|
1341 | 1387 | |
1342 | 1388 | echo ' |
1343 | 1389 | </li>'; |
@@ -1377,10 +1423,11 @@ discard block |
||
1377 | 1423 | <strong>', $txt['setup_verification_answer'], '</strong> |
1378 | 1424 | </dd>'; |
1379 | 1425 | |
1380 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1381 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1426 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1427 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1382 | 1428 | { |
1383 | 1429 | $question = $context['question_answers'][$q_id]; |
1430 | + } |
|
1384 | 1431 | |
1385 | 1432 | echo ' |
1386 | 1433 | <dt> |
@@ -1388,9 +1435,10 @@ discard block |
||
1388 | 1435 | </dt> |
1389 | 1436 | <dd>'; |
1390 | 1437 | |
1391 | - foreach ($question['answers'] as $answer) |
|
1392 | - echo ' |
|
1438 | + foreach ($question['answers'] as $answer) { |
|
1439 | + echo ' |
|
1393 | 1440 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">'; |
1441 | + } |
|
1394 | 1442 | |
1395 | 1443 | echo ' |
1396 | 1444 | <div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1429,11 +1477,12 @@ discard block |
||
1429 | 1477 | ', $txt['errors_found'], ': |
1430 | 1478 | <ul>'; |
1431 | 1479 | |
1432 | - foreach ($context['repair_errors'] as $error) |
|
1433 | - echo ' |
|
1480 | + foreach ($context['repair_errors'] as $error) { |
|
1481 | + echo ' |
|
1434 | 1482 | <li> |
1435 | 1483 | ', $error, ' |
1436 | 1484 | </li>'; |
1485 | + } |
|
1437 | 1486 | |
1438 | 1487 | echo ' |
1439 | 1488 | </ul> |
@@ -1443,16 +1492,15 @@ discard block |
||
1443 | 1492 | <p class="padding"> |
1444 | 1493 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1445 | 1494 | </p>'; |
1446 | - } |
|
1447 | - else |
|
1448 | - echo ' |
|
1495 | + } else { |
|
1496 | + echo ' |
|
1449 | 1497 | <p>', $txt['maintain_no_errors'], '</p> |
1450 | 1498 | <p class="padding"> |
1451 | 1499 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1452 | 1500 | </p>'; |
1501 | + } |
|
1453 | 1502 | |
1454 | - } |
|
1455 | - else |
|
1503 | + } else |
|
1456 | 1504 | { |
1457 | 1505 | if (!empty($context['redirect_to_recount'])) |
1458 | 1506 | { |
@@ -1464,8 +1512,7 @@ discard block |
||
1464 | 1512 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1465 | 1513 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1466 | 1514 | </form>'; |
1467 | - } |
|
1468 | - else |
|
1515 | + } else |
|
1469 | 1516 | { |
1470 | 1517 | echo ' |
1471 | 1518 | <p>', $txt['errors_fixed'], '</p> |
@@ -1619,8 +1666,8 @@ discard block |
||
1619 | 1666 | { |
1620 | 1667 | global $context, $txt; |
1621 | 1668 | |
1622 | - if ($context['user']['is_admin']) |
|
1623 | - echo ' |
|
1669 | + if ($context['user']['is_admin']) { |
|
1670 | + echo ' |
|
1624 | 1671 | <span class="floatright admin_search"> |
1625 | 1672 | <span class="generic_icons filter centericon"></span> |
1626 | 1673 | <input type="search" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';"> |
@@ -1631,6 +1678,7 @@ discard block |
||
1631 | 1678 | </select> |
1632 | 1679 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button"> |
1633 | 1680 | </span>'; |
1634 | -} |
|
1681 | + } |
|
1682 | + } |
|
1635 | 1683 | |
1636 | 1684 | ?> |
1637 | 1685 | \ No newline at end of file |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['members_list'], '</span>'; |
29 | 29 | |
30 | - if (!isset($context['old_search'])) |
|
31 | - echo ' |
|
30 | + if (!isset($context['old_search'])) { |
|
31 | + echo ' |
|
32 | 32 | <span class="floatright">', $context['letter_links'], '</span>'; |
33 | + } |
|
33 | 34 | echo ' |
34 | 35 | </h3> |
35 | 36 | </div>'; |
@@ -44,19 +45,22 @@ discard block |
||
44 | 45 | foreach ($context['columns'] as $key => $column) |
45 | 46 | { |
46 | 47 | // @TODO maybe find something nicer? |
47 | - if ($key == 'email_address' && !$context['can_send_email']) |
|
48 | - continue; |
|
48 | + if ($key == 'email_address' && !$context['can_send_email']) { |
|
49 | + continue; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | // This is a selected column, so underline it or some such. |
51 | - if ($column['selected']) |
|
52 | - echo ' |
|
53 | + if ($column['selected']) { |
|
54 | + echo ' |
|
53 | 55 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', ' selected" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . '> |
54 | 56 | <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></th>'; |
57 | + } |
|
55 | 58 | // This is just some column... show the link and be done with it. |
56 | - else |
|
57 | - echo ' |
|
59 | + else { |
|
60 | + echo ' |
|
58 | 61 | <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' style="width: ' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '> |
59 | 62 | ', $column['link'], '</th>'; |
63 | + } |
|
60 | 64 | } |
61 | 65 | echo ' |
62 | 66 | </tr> |
@@ -75,9 +79,10 @@ discard block |
||
75 | 79 | </td> |
76 | 80 | <td class="lefttext">', $member['link'], '</td>'; |
77 | 81 | |
78 | - if (!isset($context['disabled_fields']['website'])) |
|
79 | - echo ' |
|
82 | + if (!isset($context['disabled_fields']['website'])) { |
|
83 | + echo ' |
|
80 | 84 | <td class="centertext website_url">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank"><span class="generic_icons www" title="' . $member['website']['title'] . '"></span></a>' : '', '</td>'; |
85 | + } |
|
81 | 86 | |
82 | 87 | // Group and date. |
83 | 88 | echo ' |
@@ -90,11 +95,12 @@ discard block |
||
90 | 95 | <td class="centertext" style="white-space: nowrap; width: 15px">', $member['posts'], '</td> |
91 | 96 | <td class="centertext statsbar" style="width: 120px">'; |
92 | 97 | |
93 | - if (!empty($member['post_percent'])) |
|
94 | - echo ' |
|
98 | + if (!empty($member['post_percent'])) { |
|
99 | + echo ' |
|
95 | 100 | <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;"> |
96 | 101 | <div style="width: ', $member['post_percent'], 'px;"></div> |
97 | 102 | </div>'; |
103 | + } |
|
98 | 104 | |
99 | 105 | echo ' |
100 | 106 | </td>'; |
@@ -103,9 +109,10 @@ discard block |
||
103 | 109 | // Show custom fields marked to be shown here |
104 | 110 | if (!empty($context['custom_profile_fields']['columns'])) |
105 | 111 | { |
106 | - foreach ($context['custom_profile_fields']['columns'] as $key => $column) |
|
107 | - echo ' |
|
112 | + foreach ($context['custom_profile_fields']['columns'] as $key => $column) { |
|
113 | + echo ' |
|
108 | 114 | <td class="righttext">', $member['options'][$key], '</td>'; |
115 | + } |
|
109 | 116 | } |
110 | 117 | |
111 | 118 | echo ' |
@@ -113,11 +120,12 @@ discard block |
||
113 | 120 | } |
114 | 121 | } |
115 | 122 | // No members? |
116 | - else |
|
117 | - echo ' |
|
123 | + else { |
|
124 | + echo ' |
|
118 | 125 | <tr> |
119 | 126 | <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td> |
120 | 127 | </tr>'; |
128 | + } |
|
121 | 129 | |
122 | 130 | echo ' |
123 | 131 | </tbody> |
@@ -130,9 +138,10 @@ discard block |
||
130 | 138 | <div class="pagelinks floatleft">', $context['page_index'], '</div>'; |
131 | 139 | |
132 | 140 | // If it is displaying the result of a search show a "search again" link to edit their criteria. |
133 | - if (isset($context['old_search'])) |
|
134 | - echo ' |
|
141 | + if (isset($context['old_search'])) { |
|
142 | + echo ' |
|
135 | 143 | <a class="button" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>'; |
144 | + } |
|
136 | 145 | echo ' |
137 | 146 | </div> |
138 | 147 | </div><!-- #memberlist -->'; |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | { |
24 | 24 | global $context, $txt; |
25 | 25 | |
26 | - if (!empty($context['simple_action'])) |
|
27 | - echo ' |
|
26 | + if (!empty($context['simple_action'])) { |
|
27 | + echo ' |
|
28 | 28 | <strong> |
29 | 29 | ', $context['error_title'], ' |
30 | 30 | </strong><br> |
31 | 31 | <div ', $context['error_code'], 'class="padding"> |
32 | 32 | ', $context['error_message'], ' |
33 | 33 | </div>'; |
34 | - else |
|
34 | + } else |
|
35 | 35 | { |
36 | 36 | echo ' |
37 | 37 | <div id="fatal_error"> |
@@ -87,21 +87,23 @@ discard block |
||
87 | 87 | |
88 | 88 | $error_types = array(); |
89 | 89 | |
90 | - foreach ($context['error_types'] as $type => $details) |
|
91 | - $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>'; |
|
90 | + foreach ($context['error_types'] as $type => $details) { |
|
91 | + $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>'; |
|
92 | + } |
|
92 | 93 | |
93 | 94 | echo ' |
94 | 95 | ', implode(' | ', $error_types), ' |
95 | 96 | </td> |
96 | 97 | </tr>'; |
97 | 98 | |
98 | - if ($context['has_filter']) |
|
99 | - echo ' |
|
99 | + if ($context['has_filter']) { |
|
100 | + echo ' |
|
100 | 101 | <tr> |
101 | 102 | <td colspan="3" class="windowbg"> |
102 | 103 | <strong> ', $txt['applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], ' [<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['clear_filter'], '</a>] |
103 | 104 | </td> |
104 | 105 | </tr>'; |
106 | + } |
|
105 | 107 | |
106 | 108 | echo ' |
107 | 109 | <tr> |
@@ -112,11 +114,12 @@ discard block |
||
112 | 114 | </tr>'; |
113 | 115 | |
114 | 116 | // No errors, then show a message |
115 | - if (count($context['errors']) == 0) |
|
116 | - echo ' |
|
117 | + if (count($context['errors']) == 0) { |
|
118 | + echo ' |
|
117 | 119 | <tr class="windowbg"> |
118 | 120 | <td class="centertext" colspan="2">', $txt['errlog_no_entries'], '</td> |
119 | 121 | </tr>'; |
122 | + } |
|
120 | 123 | |
121 | 124 | // we have some errors, must be some mods installed :P |
122 | 125 | foreach ($context['errors'] as $error) |
@@ -130,19 +133,21 @@ discard block |
||
130 | 133 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['reverse_direction'], '"><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></a> |
131 | 134 | ', $error['time'], '<br>'; |
132 | 135 | |
133 | - if (!empty($error['member']['ip'])) |
|
134 | - echo ' |
|
136 | + if (!empty($error['member']['ip'])) { |
|
137 | + echo ' |
|
135 | 138 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $error['member']['ip'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '"><span class="generic_icons filter centericon"></span></a> |
136 | 139 | <strong><a href="', $scripturl, '?action=trackip;searchip=', $error['member']['ip'], '">', $error['member']['ip'], '</a></strong> <br>'; |
140 | + } |
|
137 | 141 | |
138 | 142 | echo ' |
139 | 143 | </div> |
140 | 144 | <div style="float: left; width: 50%; line-height: 1.8em; padding: 0 4px;">'; |
141 | 145 | |
142 | - if ($error['member']['session'] != '') |
|
143 | - echo ' |
|
146 | + if ($error['member']['session'] != '') { |
|
147 | + echo ' |
|
144 | 148 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $error['member']['session'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '"><span class="generic_icons filter centericon"></span></a> |
145 | 149 | ', $error['member']['session'], '<br>'; |
150 | + } |
|
146 | 151 | |
147 | 152 | echo ' |
148 | 153 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=error_type;value=', $error['error_type']['type'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '"><span class="generic_icons filter centericon"></span></a> |
@@ -156,8 +161,8 @@ discard block |
||
156 | 161 | <a style="display: table-cell;" href="', $error['url']['html'], '">', $error['url']['html'], '</a> |
157 | 162 | </div>'; |
158 | 163 | |
159 | - if (!empty($error['file'])) |
|
160 | - echo ' |
|
164 | + if (!empty($error['file'])) { |
|
165 | + echo ' |
|
161 | 166 | <div style="float: left; width: 100%; padding: 4px 0; line-height: 1.6em; border-top: 1px solid #e3e3e3;"> |
162 | 167 | <a style="display: table-cell; padding: 4px; width: 20px; vertical-align: top;" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=file;value=', $error['file']['search'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '"><span class="generic_icons filter"></span></a> |
163 | 168 | <div> |
@@ -165,6 +170,7 @@ discard block |
||
165 | 170 | ', $txt['line'], ': ', $error['file']['line'], ' |
166 | 171 | </div> |
167 | 172 | </div>'; |
173 | + } |
|
168 | 174 | |
169 | 175 | echo ' |
170 | 176 | </td> |
@@ -192,9 +198,10 @@ discard block |
||
192 | 198 | </div> |
193 | 199 | </div>'; |
194 | 200 | |
195 | - if ($context['sort_direction'] == 'down') |
|
196 | - echo ' |
|
201 | + if ($context['sort_direction'] == 'down') { |
|
202 | + echo ' |
|
197 | 203 | <input type="hidden" name="desc" value="1">'; |
204 | + } |
|
198 | 205 | |
199 | 206 | echo ' |
200 | 207 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | foreach ($message['custom_fields']['above_member'] as $custom) |
234 | 234 | echo ' |
235 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
235 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
236 | 236 | |
237 | 237 | echo ' |
238 | 238 | </ul> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | if (!empty($message['custom_fields']['below_avatar'])) |
270 | 270 | foreach ($message['custom_fields']['below_avatar'] as $custom) |
271 | 271 | echo ' |
272 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
272 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
273 | 273 | |
274 | 274 | if (!$message['member']['is_guest']) |
275 | 275 | echo ' |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | foreach ($message['custom_fields']['icons'] as $custom) |
313 | 313 | echo ' |
314 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
314 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
315 | 315 | |
316 | 316 | echo ' |
317 | 317 | </ol> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | if (!empty($message['custom_fields']['standard'])) |
370 | 370 | foreach ($message['custom_fields']['standard'] as $custom) |
371 | 371 | echo ' |
372 | - <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
372 | + <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
373 | 373 | |
374 | 374 | // Are we showing the warning status? |
375 | 375 | if ($message['member']['can_see_warning']) |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | if (!empty($message['custom_fields']['bottom_poster'])) |
381 | 381 | foreach ($message['custom_fields']['bottom_poster'] as $custom) |
382 | 382 | echo ' |
383 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
383 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | // Done with the information about the poster... on to the post itself. |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | foreach ($message['custom_fields']['above_signature'] as $custom) |
483 | 483 | echo ' |
484 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
484 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
485 | 485 | |
486 | 486 | echo ' |
487 | 487 | </ul> |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | foreach ($message['custom_fields']['below_signature'] as $custom) |
504 | 504 | echo ' |
505 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
505 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
506 | 506 | |
507 | 507 | echo ' |
508 | 508 | </ul> |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | while ($message = $context['get_pmessage']('subject')) |
642 | 642 | { |
643 | 643 | echo ' |
644 | - <tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '','"> |
|
644 | + <tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '', '"> |
|
645 | 645 | <td class="table_icon"> |
646 | 646 | <script> |
647 | 647 | currentLabels[', $message['id'], '] = {'; |
@@ -926,13 +926,13 @@ discard block |
||
926 | 926 | // You can only reply if they are not a guest... |
927 | 927 | if (!$message['member']['is_guest']) |
928 | 928 | echo ' |
929 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
|
930 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
|
929 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button, '</a>', $context['menu_separator'], ' |
|
930 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a> ', $context['menu_separator']; |
|
931 | 931 | |
932 | 932 | // This is for "forwarding" - even if the member is gone. |
933 | 933 | else |
934 | 934 | echo ' |
935 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
|
935 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button, '</a>', $context['menu_separator']; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | echo ' |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors"> |
1038 | 1038 | <dl> |
1039 | 1039 | <dt> |
1040 | - <strong id="error_serious">', $txt['error_while_submitting'] , '</strong> |
|
1040 | + <strong id="error_serious">', $txt['error_while_submitting'], '</strong> |
|
1041 | 1041 | </dt> |
1042 | 1042 | <dd class="error" id="error_list"> |
1043 | 1043 | ', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), ' |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | <span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span> |
1094 | 1094 | </dt> |
1095 | 1095 | <dd id="pm_subject"> |
1096 | - <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"',isset($context['post_error']['no_subject']) ? ' class="error"' : '', '/> |
|
1096 | + <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '/> |
|
1097 | 1097 | </dd> |
1098 | 1098 | </dl> |
1099 | 1099 | <hr>'; |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | echo ' |
1463 | 1463 | <div class="padding"> |
1464 | 1464 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1465 | - <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
|
1465 | + <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'], '" class="button you_sure"> |
|
1466 | 1466 | </div>'; |
1467 | 1467 | |
1468 | 1468 | echo ' |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | if (!empty($context['rules'])) |
1628 | 1628 | echo ' |
1629 | 1629 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1630 | - <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
|
1630 | + <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'], '" class="button smalltext you_sure">'; |
|
1631 | 1631 | |
1632 | 1632 | echo ' |
1633 | 1633 | </div> |
@@ -1871,9 +1871,9 @@ discard block |
||
1871 | 1871 | |
1872 | 1872 | echo ' |
1873 | 1873 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
1874 | - <option value="">', $txt['pm_rule_sel_action'] , ':</option> |
|
1875 | - <option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'] , '</option> |
|
1876 | - <option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'] , '</option> |
|
1874 | + <option value="">', $txt['pm_rule_sel_action'], ':</option> |
|
1875 | + <option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'], '</option> |
|
1876 | + <option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'], '</option> |
|
1877 | 1877 | </select> |
1878 | 1878 | <span id="labdiv', $k, '"> |
1879 | 1879 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | </div> |
1988 | 1988 | <ul class="quickbuttons"> |
1989 | 1989 | <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons modifybutton"></span>', $txt['draft_edit'], '</a></li> |
1990 | - <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'] ,'?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li> |
|
1990 | + <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'], '?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li> |
|
1991 | 1991 | </ul> |
1992 | 1992 | </div><!-- .windowbg -->'; |
1993 | 1993 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | <div id="personal_messages">'; |
22 | 22 | |
23 | 23 | // Show the capacity bar, if available. |
24 | - if (!empty($context['limit_bar'])) |
|
25 | - echo ' |
|
24 | + if (!empty($context['limit_bar'])) { |
|
25 | + echo ' |
|
26 | 26 | <div class="cat_bar"> |
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['pm_capacity'], ':</span> |
@@ -32,14 +32,16 @@ discard block |
||
32 | 32 | <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
33 | 33 | </h3> |
34 | 34 | </div>'; |
35 | + } |
|
35 | 36 | |
36 | 37 | // Message sent? Show a small indication. |
37 | - if (isset($context['pm_sent'])) |
|
38 | - echo ' |
|
38 | + if (isset($context['pm_sent'])) { |
|
39 | + echo ' |
|
39 | 40 | <div class="infobox"> |
40 | 41 | ', $txt['pm_sent'], ' |
41 | 42 | </div>'; |
42 | -} |
|
43 | + } |
|
44 | + } |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Just the end of the index bar, nothing special. |
@@ -72,8 +74,7 @@ discard block |
||
72 | 74 | { |
73 | 75 | echo ' |
74 | 76 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
75 | - } |
|
76 | - else |
|
77 | + } else |
|
77 | 78 | { |
78 | 79 | foreach ($context['unread_pms'] as $id_pm => $pm_details) |
79 | 80 | { |
@@ -194,14 +195,15 @@ discard block |
||
194 | 195 | if ($context['get_pmessage']('message', true)) |
195 | 196 | { |
196 | 197 | // Show the helpful titlebar - generally. |
197 | - if ($context['display_mode'] != 1) |
|
198 | - echo ' |
|
198 | + if ($context['display_mode'] != 1) { |
|
199 | + echo ' |
|
199 | 200 | <div class="cat_bar"> |
200 | 201 | <h3 class="catbg"> |
201 | 202 | <span id="author">', $txt['author'], '</span> |
202 | 203 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
203 | 204 | </h3> |
204 | 205 | </div>'; |
206 | + } |
|
205 | 207 | |
206 | 208 | // Show a few buttons if we are in conversation mode and outputting the first message. |
207 | 209 | if ($context['display_mode'] == 2) |
@@ -230,9 +232,10 @@ discard block |
||
230 | 232 | <div class="custom_fields_above_member"> |
231 | 233 | <ul class="nolist">'; |
232 | 234 | |
233 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
234 | - echo ' |
|
235 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
236 | + echo ' |
|
235 | 237 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
238 | + } |
|
236 | 239 | |
237 | 240 | echo ' |
238 | 241 | </ul> |
@@ -244,25 +247,28 @@ discard block |
||
244 | 247 | <a id="msg', $message['id'], '"></a>'; |
245 | 248 | |
246 | 249 | // Show online and offline buttons? |
247 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
248 | - echo ' |
|
250 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
251 | + echo ' |
|
249 | 252 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
253 | + } |
|
250 | 254 | |
251 | 255 | // Custom fields BEFORE the username? |
252 | - if (!empty($message['custom_fields']['before_member'])) |
|
253 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
256 | + if (!empty($message['custom_fields']['before_member'])) { |
|
257 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
254 | 258 | echo ' |
255 | 259 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
260 | + } |
|
256 | 261 | |
257 | 262 | // Show a link to the member's profile. |
258 | 263 | echo ' |
259 | 264 | ', $message['member']['link']; |
260 | 265 | |
261 | 266 | // Custom fields AFTER the username? |
262 | - if (!empty($message['custom_fields']['after_member'])) |
|
263 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
267 | + if (!empty($message['custom_fields']['after_member'])) { |
|
268 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
264 | 269 | echo ' |
265 | 270 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
271 | + } |
|
266 | 272 | |
267 | 273 | echo ' |
268 | 274 | </h4>'; |
@@ -271,48 +277,56 @@ discard block |
||
271 | 277 | <ul class="user_info">'; |
272 | 278 | |
273 | 279 | // Show the user's avatar. |
274 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
275 | - echo ' |
|
280 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
281 | + echo ' |
|
276 | 282 | <li class="avatar"> |
277 | 283 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
278 | 284 | </li>'; |
285 | + } |
|
279 | 286 | |
280 | 287 | // Are there any custom fields below the avatar? |
281 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
282 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
288 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
289 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
283 | 290 | echo ' |
284 | 291 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
292 | + } |
|
285 | 293 | |
286 | - if (!$message['member']['is_guest']) |
|
287 | - echo ' |
|
294 | + if (!$message['member']['is_guest']) { |
|
295 | + echo ' |
|
288 | 296 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
297 | + } |
|
289 | 298 | // Show the member's primary group (like 'Administrator') if they have one. |
290 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
291 | - echo ' |
|
299 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
300 | + echo ' |
|
292 | 301 | <li class="membergroup">', $message['member']['group'], '</li>'; |
302 | + } |
|
293 | 303 | |
294 | 304 | // Show the member's custom title, if they have one. |
295 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
296 | - echo ' |
|
305 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
306 | + echo ' |
|
297 | 307 | <li class="title">', $message['member']['title'], '</li>'; |
308 | + } |
|
298 | 309 | |
299 | 310 | // Don't show these things for guests. |
300 | 311 | if (!$message['member']['is_guest']) |
301 | 312 | { |
302 | 313 | // 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. |
303 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
304 | - echo ' |
|
314 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
315 | + echo ' |
|
305 | 316 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
317 | + } |
|
306 | 318 | |
307 | 319 | // Show how many posts they have made. |
308 | - if (!isset($context['disabled_fields']['posts'])) |
|
309 | - echo ' |
|
320 | + if (!isset($context['disabled_fields']['posts'])) { |
|
321 | + echo ' |
|
310 | 322 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
323 | + } |
|
311 | 324 | |
312 | 325 | // Show their personal text? |
313 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
314 | - echo ' |
|
326 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
327 | + echo ' |
|
315 | 328 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
329 | + } |
|
316 | 330 | |
317 | 331 | // Any custom fields to show as icons? |
318 | 332 | if (!empty($message['custom_fields']['icons'])) |
@@ -321,9 +335,10 @@ discard block |
||
321 | 335 | <li class="im_icons"> |
322 | 336 | <ol>'; |
323 | 337 | |
324 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
325 | - echo ' |
|
338 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
339 | + echo ' |
|
326 | 340 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
341 | + } |
|
327 | 342 | |
328 | 343 | echo ' |
329 | 344 | </ol> |
@@ -331,19 +346,22 @@ discard block |
||
331 | 346 | } |
332 | 347 | |
333 | 348 | // Show the IP to this user for this post - because you can moderate? |
334 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
335 | - echo ' |
|
349 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
350 | + echo ' |
|
336 | 351 | <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>'; |
352 | + } |
|
337 | 353 | |
338 | 354 | // Or, should we show it because this is you? |
339 | - elseif ($message['can_see_ip']) |
|
340 | - echo ' |
|
355 | + elseif ($message['can_see_ip']) { |
|
356 | + echo ' |
|
341 | 357 | <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>'; |
358 | + } |
|
342 | 359 | |
343 | 360 | // Okay, you are logged in, then we can show something about why IPs are logged... |
344 | - else |
|
345 | - echo ' |
|
361 | + else { |
|
362 | + echo ' |
|
346 | 363 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
364 | + } |
|
347 | 365 | |
348 | 366 | // Show the profile, website, email address, and personal message buttons. |
349 | 367 | if ($message['member']['show_profile_buttons']) |
@@ -353,24 +371,28 @@ discard block |
||
353 | 371 | <ol class="profile_icons">'; |
354 | 372 | |
355 | 373 | // Show the profile button |
356 | - if ($message['member']['can_view_profile']) |
|
357 | - echo ' |
|
374 | + if ($message['member']['can_view_profile']) { |
|
375 | + echo ' |
|
358 | 376 | <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
377 | + } |
|
359 | 378 | |
360 | 379 | // Don't show an icon if they haven't specified a website. |
361 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
362 | - echo ' |
|
380 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
381 | + echo ' |
|
363 | 382 | <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>'; |
383 | + } |
|
364 | 384 | |
365 | 385 | // Don't show the email address if they want it hidden. |
366 | - if ($message['member']['show_email']) |
|
367 | - echo ' |
|
386 | + if ($message['member']['show_email']) { |
|
387 | + echo ' |
|
368 | 388 | <li><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>'; |
389 | + } |
|
369 | 390 | |
370 | 391 | // Since we know this person isn't a guest, you *can* message them. |
371 | - if ($context['can_send_pm']) |
|
372 | - echo ' |
|
392 | + if ($context['can_send_pm']) { |
|
393 | + echo ' |
|
373 | 394 | <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>'; |
395 | + } |
|
374 | 396 | |
375 | 397 | echo ' |
376 | 398 | </ol> |
@@ -378,21 +400,24 @@ discard block |
||
378 | 400 | } |
379 | 401 | |
380 | 402 | // Any custom fields for standard placement? |
381 | - if (!empty($message['custom_fields']['standard'])) |
|
382 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
403 | + if (!empty($message['custom_fields']['standard'])) { |
|
404 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
383 | 405 | echo ' |
384 | 406 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
407 | + } |
|
385 | 408 | |
386 | 409 | // Are we showing the warning status? |
387 | - if ($message['member']['can_see_warning']) |
|
388 | - echo ' |
|
410 | + if ($message['member']['can_see_warning']) { |
|
411 | + echo ' |
|
389 | 412 | <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>'; |
413 | + } |
|
390 | 414 | |
391 | 415 | // Are there any custom fields to show at the bottom of the poster info? |
392 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
393 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
416 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
417 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
394 | 418 | echo ' |
395 | 419 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
420 | + } |
|
396 | 421 | } |
397 | 422 | |
398 | 423 | // Done with the information about the poster... on to the post itself. |
@@ -411,25 +436,29 @@ discard block |
||
411 | 436 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
412 | 437 | |
413 | 438 | // People it was sent directly to.... |
414 | - if (!empty($message['recipients']['to'])) |
|
415 | - echo implode(', ', $message['recipients']['to']); |
|
439 | + if (!empty($message['recipients']['to'])) { |
|
440 | + echo implode(', ', $message['recipients']['to']); |
|
441 | + } |
|
416 | 442 | |
417 | 443 | // Otherwise, we're just going to say "some people"... |
418 | - elseif ($context['folder'] != 'sent') |
|
419 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
444 | + elseif ($context['folder'] != 'sent') { |
|
445 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
446 | + } |
|
420 | 447 | |
421 | 448 | echo ' |
422 | 449 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
423 | 450 | </span>'; |
424 | 451 | |
425 | 452 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
426 | - if (!empty($message['recipients']['bcc'])) |
|
427 | - echo ' |
|
453 | + if (!empty($message['recipients']['bcc'])) { |
|
454 | + echo ' |
|
428 | 455 | <br><span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
456 | + } |
|
429 | 457 | |
430 | - if (!empty($message['is_replied_to'])) |
|
431 | - echo ' |
|
458 | + if (!empty($message['is_replied_to'])) { |
|
459 | + echo ' |
|
432 | 460 | <br><span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
461 | + } |
|
433 | 462 | |
434 | 463 | echo ' |
435 | 464 | </div><!-- .keyinfo --> |
@@ -437,13 +466,15 @@ discard block |
||
437 | 466 | <div class="post"> |
438 | 467 | <div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>'; |
439 | 468 | |
440 | - if ($message['can_report'] || $context['can_send_pm']) |
|
441 | - echo ' |
|
469 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
470 | + echo ' |
|
442 | 471 | <div class="under_message">'; |
472 | + } |
|
443 | 473 | |
444 | - if ($message['can_report']) |
|
445 | - echo ' |
|
474 | + if ($message['can_report']) { |
|
475 | + echo ' |
|
446 | 476 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
477 | + } |
|
447 | 478 | |
448 | 479 | echo ' |
449 | 480 | <ul class="quickbuttons">'; |
@@ -455,32 +486,36 @@ discard block |
||
455 | 486 | if (!$message['member']['is_guest']) |
456 | 487 | { |
457 | 488 | // Is there than more than one recipient you can reply to? |
458 | - if ($message['number_recipients'] > 1) |
|
459 | - echo ' |
|
489 | + if ($message['number_recipients'] > 1) { |
|
490 | + echo ' |
|
460 | 491 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
492 | + } |
|
461 | 493 | |
462 | 494 | echo ' |
463 | 495 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
464 | 496 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
465 | 497 | } |
466 | 498 | // This is for "forwarding" - even if the member is gone. |
467 | - else |
|
468 | - echo ' |
|
499 | + else { |
|
500 | + echo ' |
|
469 | 501 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
502 | + } |
|
470 | 503 | } |
471 | 504 | echo ' |
472 | 505 | <li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
473 | 506 | |
474 | - if (empty($context['display_mode'])) |
|
475 | - echo ' |
|
507 | + if (empty($context['display_mode'])) { |
|
508 | + echo ' |
|
476 | 509 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
510 | + } |
|
477 | 511 | |
478 | 512 | echo ' |
479 | 513 | </ul>'; |
480 | 514 | |
481 | - if ($message['can_report'] || $context['can_send_pm']) |
|
482 | - echo ' |
|
515 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
516 | + echo ' |
|
483 | 517 | </div><!-- .under_message -->'; |
518 | + } |
|
484 | 519 | |
485 | 520 | // Are there any custom profile fields for above the signature? |
486 | 521 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -489,9 +524,10 @@ discard block |
||
489 | 524 | <div class="custom_fields_above_signature"> |
490 | 525 | <ul class="nolist">'; |
491 | 526 | |
492 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
493 | - echo ' |
|
527 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
528 | + echo ' |
|
494 | 529 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
530 | + } |
|
495 | 531 | |
496 | 532 | echo ' |
497 | 533 | </ul> |
@@ -499,9 +535,10 @@ discard block |
||
499 | 535 | } |
500 | 536 | |
501 | 537 | // Show the member's signature? |
502 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
503 | - echo ' |
|
538 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
539 | + echo ' |
|
504 | 540 | <div class="signature">', $message['member']['signature'], '</div>'; |
541 | + } |
|
505 | 542 | |
506 | 543 | // Are there any custom profile fields for below the signature? |
507 | 544 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -510,9 +547,10 @@ discard block |
||
510 | 547 | <div class="custom_fields_below_signature"> |
511 | 548 | <ul class="nolist">'; |
512 | 549 | |
513 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
514 | - echo ' |
|
550 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
551 | + echo ' |
|
515 | 552 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
553 | + } |
|
516 | 554 | |
517 | 555 | echo ' |
518 | 556 | </ul> |
@@ -539,10 +577,11 @@ discard block |
||
539 | 577 | echo ' |
540 | 578 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
541 | 579 | |
542 | - foreach ($context['labels'] as $label) |
|
543 | - if (!isset($message['labels'][$label['id']])) |
|
580 | + foreach ($context['labels'] as $label) { |
|
581 | + if (!isset($message['labels'][$label['id']])) |
|
544 | 582 | echo ' |
545 | 583 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
584 | + } |
|
546 | 585 | } |
547 | 586 | |
548 | 587 | // ... and are there any that can be removed? |
@@ -551,9 +590,10 @@ discard block |
||
551 | 590 | echo ' |
552 | 591 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
553 | 592 | |
554 | - foreach ($message['labels'] as $label) |
|
555 | - echo ' |
|
593 | + foreach ($message['labels'] as $label) { |
|
594 | + echo ' |
|
556 | 595 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
596 | + } |
|
557 | 597 | } |
558 | 598 | echo ' |
559 | 599 | </select> |
@@ -572,8 +612,8 @@ discard block |
||
572 | 612 | </div><!-- .windowbg -->'; |
573 | 613 | } |
574 | 614 | |
575 | - if (empty($context['display_mode'])) |
|
576 | - echo ' |
|
615 | + if (empty($context['display_mode'])) { |
|
616 | + echo ' |
|
577 | 617 | |
578 | 618 | <div class="pagesection"> |
579 | 619 | <div class="floatleft">', $context['page_index'], '</div> |
@@ -581,6 +621,7 @@ discard block |
||
581 | 621 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
582 | 622 | </div> |
583 | 623 | </div>'; |
624 | + } |
|
584 | 625 | |
585 | 626 | // Show a few buttons if we are in conversation mode and outputting the first message. |
586 | 627 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -641,11 +682,12 @@ discard block |
||
641 | 682 | </thead> |
642 | 683 | <tbody>'; |
643 | 684 | |
644 | - if (!$context['show_delete']) |
|
645 | - echo ' |
|
685 | + if (!$context['show_delete']) { |
|
686 | + echo ' |
|
646 | 687 | <tr class="windowbg"> |
647 | 688 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
648 | 689 | </tr>'; |
690 | + } |
|
649 | 691 | |
650 | 692 | while ($message = $context['get_pmessage']('subject')) |
651 | 693 | { |
@@ -705,9 +747,10 @@ discard block |
||
705 | 747 | |
706 | 748 | foreach ($context['labels'] as $label) |
707 | 749 | { |
708 | - if ($label['id'] != $context['current_label_id']) |
|
709 | - echo ' |
|
750 | + if ($label['id'] != $context['current_label_id']) { |
|
751 | + echo ' |
|
710 | 752 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
753 | + } |
|
711 | 754 | } |
712 | 755 | |
713 | 756 | echo ' |
@@ -793,9 +836,10 @@ discard block |
||
793 | 836 | <dd>', $txt['pm_search_between'], ' <input type="number" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" min="0" max="9999"> ', $txt['pm_search_between_and'], ' <input type="number" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" min="0" max="9999"> ', $txt['pm_search_between_days'], '</dd> |
794 | 837 | </dl>'; |
795 | 838 | |
796 | - if (!$context['currently_using_labels']) |
|
797 | - echo ' |
|
839 | + if (!$context['currently_using_labels']) { |
|
840 | + echo ' |
|
798 | 841 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button">'; |
842 | + } |
|
799 | 843 | |
800 | 844 | echo ' |
801 | 845 | <br class="clear_right"> |
@@ -816,12 +860,13 @@ discard block |
||
816 | 860 | <div id="advanced_panel_div"> |
817 | 861 | <ul id="searchLabelsExpand">'; |
818 | 862 | |
819 | - foreach ($context['search_labels'] as $label) |
|
820 | - echo ' |
|
863 | + foreach ($context['search_labels'] as $label) { |
|
864 | + echo ' |
|
821 | 865 | <li> |
822 | 866 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
823 | 867 | ', $label['name'], '</label> |
824 | 868 | </li>'; |
869 | + } |
|
825 | 870 | |
826 | 871 | echo ' |
827 | 872 | </ul> |
@@ -883,8 +928,8 @@ discard block |
||
883 | 928 | </div>'; |
884 | 929 | |
885 | 930 | // complete results ? |
886 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
887 | - echo ' |
|
931 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
932 | + echo ' |
|
888 | 933 | <table class="table_grid"> |
889 | 934 | <thead> |
890 | 935 | <tr class="title_bar"> |
@@ -894,6 +939,7 @@ discard block |
||
894 | 939 | </tr> |
895 | 940 | </thead> |
896 | 941 | <tbody>'; |
942 | + } |
|
897 | 943 | |
898 | 944 | // Print each message out... |
899 | 945 | foreach ($context['personal_messages'] as $message) |
@@ -913,12 +959,14 @@ discard block |
||
913 | 959 | |
914 | 960 | // Show the recipients. |
915 | 961 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
916 | - if (!empty($message['recipients']['to'])) |
|
917 | - echo implode(', ', $message['recipients']['to']); |
|
962 | + if (!empty($message['recipients']['to'])) { |
|
963 | + echo implode(', ', $message['recipients']['to']); |
|
964 | + } |
|
918 | 965 | |
919 | 966 | // Otherwise, we're just going to say "some people"... |
920 | - elseif ($context['folder'] != 'sent') |
|
921 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
967 | + elseif ($context['folder'] != 'sent') { |
|
968 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
969 | + } |
|
922 | 970 | |
923 | 971 | echo ' |
924 | 972 | </h3> |
@@ -933,15 +981,17 @@ discard block |
||
933 | 981 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
934 | 982 | |
935 | 983 | // You can only reply if they are not a guest... |
936 | - if (!$message['member']['is_guest']) |
|
937 | - echo ' |
|
984 | + if (!$message['member']['is_guest']) { |
|
985 | + echo ' |
|
938 | 986 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
939 | 987 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
988 | + } |
|
940 | 989 | |
941 | 990 | // This is for "forwarding" - even if the member is gone. |
942 | - else |
|
943 | - echo ' |
|
991 | + else { |
|
992 | + echo ' |
|
944 | 993 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
994 | + } |
|
945 | 995 | } |
946 | 996 | |
947 | 997 | echo ' |
@@ -962,17 +1012,19 @@ discard block |
||
962 | 1012 | } |
963 | 1013 | |
964 | 1014 | // Finish off the page... |
965 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
966 | - echo ' |
|
1015 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
1016 | + echo ' |
|
967 | 1017 | </tbody> |
968 | 1018 | </table>'; |
1019 | + } |
|
969 | 1020 | |
970 | 1021 | // No results? |
971 | - if (empty($context['personal_messages'])) |
|
972 | - echo ' |
|
1022 | + if (empty($context['personal_messages'])) { |
|
1023 | + echo ' |
|
973 | 1024 | <div class="windowbg"> |
974 | 1025 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
975 | 1026 | </div>'; |
1027 | + } |
|
976 | 1028 | |
977 | 1029 | echo ' |
978 | 1030 | <div class="pagesection"> |
@@ -997,15 +1049,17 @@ discard block |
||
997 | 1049 | </div> |
998 | 1050 | <div class="windowbg">'; |
999 | 1051 | |
1000 | - if (!empty($context['send_log']['sent'])) |
|
1001 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
1052 | + if (!empty($context['send_log']['sent'])) { |
|
1053 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
1002 | 1054 | echo ' |
1003 | 1055 | <span class="error">', $log_entry, '</span><br>'; |
1056 | + } |
|
1004 | 1057 | |
1005 | - if (!empty($context['send_log']['failed'])) |
|
1006 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
1058 | + if (!empty($context['send_log']['failed'])) { |
|
1059 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
1007 | 1060 | echo ' |
1008 | 1061 | <span class="error">', $log_entry, '</span><br>'; |
1062 | + } |
|
1009 | 1063 | |
1010 | 1064 | echo ' |
1011 | 1065 | </div> |
@@ -1054,12 +1108,13 @@ discard block |
||
1054 | 1108 | </dl> |
1055 | 1109 | </div>'; |
1056 | 1110 | |
1057 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
1058 | - echo ' |
|
1111 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
1112 | + echo ' |
|
1059 | 1113 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1060 | 1114 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1061 | 1115 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1062 | 1116 | </div>'; |
1117 | + } |
|
1063 | 1118 | |
1064 | 1119 | echo ' |
1065 | 1120 | <dl id="post_header">'; |
@@ -1115,9 +1170,10 @@ discard block |
||
1115 | 1170 | } |
1116 | 1171 | |
1117 | 1172 | // What about smileys? |
1118 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
1119 | - echo ' |
|
1173 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
1174 | + echo ' |
|
1120 | 1175 | <div id="smileyBox_message"></div>'; |
1176 | + } |
|
1121 | 1177 | |
1122 | 1178 | // Show BBC buttons, smileys and textbox. |
1123 | 1179 | echo ' |
@@ -1164,10 +1220,11 @@ discard block |
||
1164 | 1220 | <dt><strong>', $txt['subject'], '</strong></dt> |
1165 | 1221 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1166 | 1222 | |
1167 | - foreach ($context['drafts'] as $draft) |
|
1168 | - echo ' |
|
1223 | + foreach ($context['drafts'] as $draft) { |
|
1224 | + echo ' |
|
1169 | 1225 | <dt>', $draft['link'], '</dt> |
1170 | 1226 | <dd>', $draft['poster_time'], '</dd>'; |
1227 | + } |
|
1171 | 1228 | echo ' |
1172 | 1229 | </dl> |
1173 | 1230 | </div>'; |
@@ -1274,8 +1331,8 @@ discard block |
||
1274 | 1331 | }'; |
1275 | 1332 | |
1276 | 1333 | // Code for showing and hiding drafts |
1277 | - if (!empty($context['drafts'])) |
|
1278 | - echo ' |
|
1334 | + if (!empty($context['drafts'])) { |
|
1335 | + echo ' |
|
1279 | 1336 | var oSwapDraftOptions = new smc_Toggle({ |
1280 | 1337 | bToggleEnabled: true, |
1281 | 1338 | bCurrentlyCollapsed: true, |
@@ -1297,13 +1354,14 @@ discard block |
||
1297 | 1354 | } |
1298 | 1355 | ] |
1299 | 1356 | });'; |
1357 | + } |
|
1300 | 1358 | |
1301 | 1359 | echo ' |
1302 | 1360 | </script>'; |
1303 | 1361 | |
1304 | 1362 | // Show the message you're replying to. |
1305 | - if ($context['reply']) |
|
1306 | - echo ' |
|
1363 | + if ($context['reply']) { |
|
1364 | + echo ' |
|
1307 | 1365 | <br><br> |
1308 | 1366 | <div class="cat_bar"> |
1309 | 1367 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1317,6 +1375,7 @@ discard block |
||
1317 | 1375 | ', $context['quoted_message']['body'], ' |
1318 | 1376 | </div> |
1319 | 1377 | <br class="clear">'; |
1378 | + } |
|
1320 | 1379 | |
1321 | 1380 | echo ' |
1322 | 1381 | <script> |
@@ -1328,23 +1387,25 @@ discard block |
||
1328 | 1387 | sToControlId: \'to_control\', |
1329 | 1388 | aToRecipients: ['; |
1330 | 1389 | |
1331 | - foreach ($context['recipients']['to'] as $i => $member) |
|
1332 | - echo ' |
|
1390 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
1391 | + echo ' |
|
1333 | 1392 | { |
1334 | 1393 | sItemId: ', JavaScriptEscape($member['id']), ', |
1335 | 1394 | sItemName: ', JavaScriptEscape($member['name']), ' |
1336 | 1395 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1396 | + } |
|
1337 | 1397 | |
1338 | 1398 | echo ' |
1339 | 1399 | ], |
1340 | 1400 | aBccRecipients: ['; |
1341 | 1401 | |
1342 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
1343 | - echo ' |
|
1402 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
1403 | + echo ' |
|
1344 | 1404 | { |
1345 | 1405 | sItemId: ', JavaScriptEscape($member['id']), ', |
1346 | 1406 | sItemName: ', JavaScriptEscape($member['name']), ' |
1347 | 1407 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1408 | + } |
|
1348 | 1409 | |
1349 | 1410 | echo ' |
1350 | 1411 | ], |
@@ -1433,26 +1494,28 @@ discard block |
||
1433 | 1494 | </th> |
1434 | 1495 | <th class="centertext table_icon">'; |
1435 | 1496 | |
1436 | - if (count($context['labels']) > 2) |
|
1437 | - echo ' |
|
1497 | + if (count($context['labels']) > 2) { |
|
1498 | + echo ' |
|
1438 | 1499 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1500 | + } |
|
1439 | 1501 | |
1440 | 1502 | echo ' |
1441 | 1503 | </th> |
1442 | 1504 | </tr> |
1443 | 1505 | </thead> |
1444 | 1506 | <tbody>'; |
1445 | - if (count($context['labels']) < 2) |
|
1446 | - echo ' |
|
1507 | + if (count($context['labels']) < 2) { |
|
1508 | + echo ' |
|
1447 | 1509 | <tr class="windowbg"> |
1448 | 1510 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1449 | 1511 | </tr>'; |
1450 | - else |
|
1512 | + } else |
|
1451 | 1513 | { |
1452 | 1514 | foreach ($context['labels'] as $label) |
1453 | 1515 | { |
1454 | - if ($label['id'] == -1) |
|
1455 | - continue; |
|
1516 | + if ($label['id'] == -1) { |
|
1517 | + continue; |
|
1518 | + } |
|
1456 | 1519 | |
1457 | 1520 | echo ' |
1458 | 1521 | <tr class="windowbg"> |
@@ -1467,12 +1530,13 @@ discard block |
||
1467 | 1530 | </tbody> |
1468 | 1531 | </table>'; |
1469 | 1532 | |
1470 | - if (!count($context['labels']) < 2) |
|
1471 | - echo ' |
|
1533 | + if (!count($context['labels']) < 2) { |
|
1534 | + echo ' |
|
1472 | 1535 | <div class="padding"> |
1473 | 1536 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1474 | 1537 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
1475 | 1538 | </div>'; |
1539 | + } |
|
1476 | 1540 | |
1477 | 1541 | echo ' |
1478 | 1542 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1528,9 +1592,10 @@ discard block |
||
1528 | 1592 | <dd> |
1529 | 1593 | <select name="id_admin"> |
1530 | 1594 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1531 | - foreach ($context['admins'] as $id => $name) |
|
1532 | - echo ' |
|
1595 | + foreach ($context['admins'] as $id => $name) { |
|
1596 | + echo ' |
|
1533 | 1597 | <option value="', $id, '">', $name, '</option>'; |
1598 | + } |
|
1534 | 1599 | echo ' |
1535 | 1600 | </select> |
1536 | 1601 | </dd>'; |
@@ -1592,9 +1657,10 @@ discard block |
||
1592 | 1657 | </th> |
1593 | 1658 | <th class="centertext table_icon">'; |
1594 | 1659 | |
1595 | - if (!empty($context['rules'])) |
|
1596 | - echo ' |
|
1660 | + if (!empty($context['rules'])) { |
|
1661 | + echo ' |
|
1597 | 1662 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1663 | + } |
|
1598 | 1664 | |
1599 | 1665 | echo ' |
1600 | 1666 | </th> |
@@ -1602,13 +1668,14 @@ discard block |
||
1602 | 1668 | </thead> |
1603 | 1669 | <tbody>'; |
1604 | 1670 | |
1605 | - if (empty($context['rules'])) |
|
1606 | - echo ' |
|
1671 | + if (empty($context['rules'])) { |
|
1672 | + echo ' |
|
1607 | 1673 | <tr class="windowbg"> |
1608 | 1674 | <td colspan="2"> |
1609 | 1675 | ', $txt['pm_rules_none'], ' |
1610 | 1676 | </td> |
1611 | 1677 | </tr>'; |
1678 | + } |
|
1612 | 1679 | |
1613 | 1680 | foreach ($context['rules'] as $rule) |
1614 | 1681 | { |
@@ -1629,14 +1696,16 @@ discard block |
||
1629 | 1696 | <div class="righttext"> |
1630 | 1697 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1631 | 1698 | |
1632 | - if (!empty($context['rules'])) |
|
1633 | - echo ' |
|
1699 | + if (!empty($context['rules'])) { |
|
1700 | + echo ' |
|
1634 | 1701 | [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
1702 | + } |
|
1635 | 1703 | |
1636 | - if (!empty($context['rules'])) |
|
1637 | - echo ' |
|
1704 | + if (!empty($context['rules'])) { |
|
1705 | + echo ' |
|
1638 | 1706 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1639 | 1707 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
1708 | + } |
|
1640 | 1709 | |
1641 | 1710 | echo ' |
1642 | 1711 | </div> |
@@ -1658,14 +1727,16 @@ discard block |
||
1658 | 1727 | var groups = new Array() |
1659 | 1728 | var labels = new Array()'; |
1660 | 1729 | |
1661 | - foreach ($context['groups'] as $id => $title) |
|
1662 | - echo ' |
|
1730 | + foreach ($context['groups'] as $id => $title) { |
|
1731 | + echo ' |
|
1663 | 1732 | groups[', $id, '] = "', addslashes($title), '";'; |
1733 | + } |
|
1664 | 1734 | |
1665 | - foreach ($context['labels'] as $label) |
|
1666 | - if ($label['id'] != -1) |
|
1735 | + foreach ($context['labels'] as $label) { |
|
1736 | + if ($label['id'] != -1) |
|
1667 | 1737 | echo ' |
1668 | 1738 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1739 | + } |
|
1669 | 1740 | |
1670 | 1741 | echo ' |
1671 | 1742 | function addCriteriaOption() |
@@ -1680,8 +1751,9 @@ discard block |
||
1680 | 1751 | |
1681 | 1752 | setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
1682 | 1753 | |
1683 | - foreach ($context['groups'] as $id => $group) |
|
1684 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1754 | + foreach ($context['groups'] as $id => $group) { |
|
1755 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1756 | + } |
|
1685 | 1757 | |
1686 | 1758 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1687 | 1759 | } |
@@ -1698,9 +1770,10 @@ discard block |
||
1698 | 1770 | |
1699 | 1771 | setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
1700 | 1772 | |
1701 | - foreach ($context['labels'] as $label) |
|
1702 | - if ($label['id'] != -1) |
|
1773 | + foreach ($context['labels'] as $label) { |
|
1774 | + if ($label['id'] != -1) |
|
1703 | 1775 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1776 | + } |
|
1704 | 1777 | |
1705 | 1778 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1706 | 1779 | } |
@@ -1814,19 +1887,20 @@ discard block |
||
1814 | 1887 | $isFirst = true; |
1815 | 1888 | foreach ($context['rule']['criteria'] as $k => $criteria) |
1816 | 1889 | { |
1817 | - if (!$isFirst && $criteria['t'] == '') |
|
1818 | - echo '<div id="removeonjs1">'; |
|
1819 | - |
|
1820 | - elseif (!$isFirst) |
|
1821 | - echo '<br>'; |
|
1890 | + if (!$isFirst && $criteria['t'] == '') { |
|
1891 | + echo '<div id="removeonjs1">'; |
|
1892 | + } elseif (!$isFirst) { |
|
1893 | + echo '<br>'; |
|
1894 | + } |
|
1822 | 1895 | |
1823 | 1896 | echo ' |
1824 | 1897 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1825 | 1898 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1826 | 1899 | |
1827 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
1828 | - echo ' |
|
1900 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
1901 | + echo ' |
|
1829 | 1902 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1903 | + } |
|
1830 | 1904 | |
1831 | 1905 | echo ' |
1832 | 1906 | </select> |
@@ -1837,19 +1911,20 @@ discard block |
||
1837 | 1911 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1838 | 1912 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1839 | 1913 | |
1840 | - foreach ($context['groups'] as $id => $group) |
|
1841 | - echo ' |
|
1914 | + foreach ($context['groups'] as $id => $group) { |
|
1915 | + echo ' |
|
1842 | 1916 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1917 | + } |
|
1843 | 1918 | echo ' |
1844 | 1919 | </select> |
1845 | 1920 | </span>'; |
1846 | 1921 | |
1847 | 1922 | // If this is the dummy we add a means to hide for non js users. |
1848 | - if ($isFirst) |
|
1849 | - $isFirst = false; |
|
1850 | - |
|
1851 | - elseif ($criteria['t'] == '') |
|
1852 | - echo '</div><!-- .removeonjs1 -->'; |
|
1923 | + if ($isFirst) { |
|
1924 | + $isFirst = false; |
|
1925 | + } elseif ($criteria['t'] == '') { |
|
1926 | + echo '</div><!-- .removeonjs1 -->'; |
|
1927 | + } |
|
1853 | 1928 | } |
1854 | 1929 | |
1855 | 1930 | echo ' |
@@ -1872,10 +1947,11 @@ discard block |
||
1872 | 1947 | $isFirst = true; |
1873 | 1948 | foreach ($context['rule']['actions'] as $k => $action) |
1874 | 1949 | { |
1875 | - if (!$isFirst && $action['t'] == '') |
|
1876 | - echo '<div id="removeonjs2">'; |
|
1877 | - elseif (!$isFirst) |
|
1878 | - echo '<br>'; |
|
1950 | + if (!$isFirst && $action['t'] == '') { |
|
1951 | + echo '<div id="removeonjs2">'; |
|
1952 | + } elseif (!$isFirst) { |
|
1953 | + echo '<br>'; |
|
1954 | + } |
|
1879 | 1955 | |
1880 | 1956 | echo ' |
1881 | 1957 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1887,19 +1963,21 @@ discard block |
||
1887 | 1963 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1888 | 1964 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1889 | 1965 | |
1890 | - foreach ($context['labels'] as $label) |
|
1891 | - if ($label['id'] != -1) |
|
1966 | + foreach ($context['labels'] as $label) { |
|
1967 | + if ($label['id'] != -1) |
|
1892 | 1968 | echo ' |
1893 | 1969 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1970 | + } |
|
1894 | 1971 | |
1895 | 1972 | echo ' |
1896 | 1973 | </select> |
1897 | 1974 | </span>'; |
1898 | 1975 | |
1899 | - if ($isFirst) |
|
1900 | - $isFirst = false; |
|
1901 | - elseif ($action['t'] == '') |
|
1902 | - echo '</div><!-- .removeonjs2 -->'; |
|
1976 | + if ($isFirst) { |
|
1977 | + $isFirst = false; |
|
1978 | + } elseif ($action['t'] == '') { |
|
1979 | + echo '</div><!-- .removeonjs2 -->'; |
|
1980 | + } |
|
1903 | 1981 | } |
1904 | 1982 | |
1905 | 1983 | echo ' |
@@ -1923,22 +2001,25 @@ discard block |
||
1923 | 2001 | echo ' |
1924 | 2002 | <script>'; |
1925 | 2003 | |
1926 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
1927 | - echo ' |
|
2004 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
2005 | + echo ' |
|
1928 | 2006 | updateRuleDef(', $k, ');'; |
2007 | + } |
|
1929 | 2008 | |
1930 | - foreach ($context['rule']['actions'] as $k => $c) |
|
1931 | - echo ' |
|
2009 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
2010 | + echo ' |
|
1932 | 2011 | updateActionDef(', $k, ');'; |
2012 | + } |
|
1933 | 2013 | |
1934 | 2014 | echo ' |
1935 | 2015 | rebuildRuleDesc();'; |
1936 | 2016 | |
1937 | 2017 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1938 | - if ($context['rid']) |
|
1939 | - echo ' |
|
2018 | + if ($context['rid']) { |
|
2019 | + echo ' |
|
1940 | 2020 | document.getElementById("removeonjs1").style.display = "none"; |
1941 | 2021 | document.getElementById("removeonjs2").style.display = "none";'; |
2022 | + } |
|
1942 | 2023 | |
1943 | 2024 | echo ' |
1944 | 2025 | document.getElementById("addonjs1").style.display = ""; |
@@ -1966,12 +2047,12 @@ discard block |
||
1966 | 2047 | </div>'; |
1967 | 2048 | |
1968 | 2049 | // No drafts? Just show an informative message. |
1969 | - if (empty($context['drafts'])) |
|
1970 | - echo ' |
|
2050 | + if (empty($context['drafts'])) { |
|
2051 | + echo ' |
|
1971 | 2052 | <div class="windowbg2 centertext"> |
1972 | 2053 | ', $txt['draft_none'], ' |
1973 | 2054 | </div>'; |
1974 | - else |
|
2055 | + } else |
|
1975 | 2056 | { |
1976 | 2057 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
1977 | 2058 | foreach ($context['drafts'] as $draft) |
@@ -28,15 +28,17 @@ discard block |
||
28 | 28 | <form class="login" action="', $context['login_url'], '" name="frmLogin" id="frmLogin" method="post" accept-charset="', $context['character_set'], '">'; |
29 | 29 | |
30 | 30 | // Did they make a mistake last time? |
31 | - if (!empty($context['login_errors'])) |
|
32 | - echo ' |
|
31 | + if (!empty($context['login_errors'])) { |
|
32 | + echo ' |
|
33 | 33 | <div class="errorbox">', implode('<br>', $context['login_errors']), '</div> |
34 | 34 | <br>'; |
35 | + } |
|
35 | 36 | |
36 | 37 | // Or perhaps there's some special description for this time? |
37 | - if (isset($context['description'])) |
|
38 | - echo ' |
|
38 | + if (isset($context['description'])) { |
|
39 | + echo ' |
|
39 | 40 | <div class="information">', $context['description'], '</div>'; |
41 | + } |
|
40 | 42 | |
41 | 43 | // Now just get the basic information - username, password, etc. |
42 | 44 | echo ' |
@@ -61,10 +63,11 @@ discard block |
||
61 | 63 | </dd>'; |
62 | 64 | |
63 | 65 | // If they have deleted their account, give them a chance to change their mind. |
64 | - if (isset($context['login_show_undelete'])) |
|
65 | - echo ' |
|
66 | + if (isset($context['login_show_undelete'])) { |
|
67 | + echo ' |
|
66 | 68 | <dt class="alert">', $txt['undelete_account'], ':</dt> |
67 | 69 | <dd><input type="checkbox" name="undelete"></dd>'; |
70 | + } |
|
68 | 71 | |
69 | 72 | echo ' |
70 | 73 | </dl> |
@@ -82,8 +85,8 @@ discard block |
||
82 | 85 | document.getElementById("', !empty($context['from_ajax']) ? 'ajax_' : '', isset($context['default_username']) && $context['default_username'] != '' ? 'loginpass' : 'loginuser', '").focus(); |
83 | 86 | }, 150);'; |
84 | 87 | |
85 | - if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2)) |
|
86 | - echo ' |
|
88 | + if (!empty($context['from_ajax']) && (empty($modSettings['force_ssl']) || $modSettings['force_ssl'] == 2)) { |
|
89 | + echo ' |
|
87 | 90 | form = $("#frmLogin"); |
88 | 91 | form.submit(function(e) { |
89 | 92 | e.preventDefault(); |
@@ -116,16 +119,18 @@ discard block |
||
116 | 119 | |
117 | 120 | return false; |
118 | 121 | });'; |
122 | + } |
|
119 | 123 | |
120 | 124 | echo ' |
121 | 125 | </script> |
122 | 126 | </form>'; |
123 | 127 | |
124 | 128 | // It is a long story as to why we have this when we're clearly not going to use it. |
125 | - if (!empty($context['from_ajax'])) |
|
126 | - echo ' |
|
129 | + if (!empty($context['from_ajax'])) { |
|
130 | + echo ' |
|
127 | 131 | <br> |
128 | 132 | <a href="javascript:self.close();"></a>'; |
133 | + } |
|
129 | 134 | echo ' |
130 | 135 | </div><!-- .roundframe --> |
131 | 136 | </div><!-- .login -->'; |
@@ -147,11 +152,12 @@ discard block |
||
147 | 152 | </div> |
148 | 153 | <div class="roundframe noup">'; |
149 | 154 | |
150 | - if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) |
|
151 | - echo ' |
|
155 | + if (!empty($context['tfa_error']) || !empty($context['tfa_backup_error'])) { |
|
156 | + echo ' |
|
152 | 157 | <div class="error"> |
153 | 158 | ', $txt['tfa_' . (!empty($context['tfa_error']) ? 'code_' : 'backup_') . 'invalid'], ' |
154 | 159 | </div>'; |
160 | + } |
|
155 | 161 | |
156 | 162 | echo ' |
157 | 163 | <form action="', $context['tfa_url'], '" method="post" id="frmTfa"> |
@@ -180,8 +186,8 @@ discard block |
||
180 | 186 | <script> |
181 | 187 | form = $("#frmTfa");'; |
182 | 188 | |
183 | - if (!empty($context['from_ajax'])) |
|
184 | - echo ' |
|
189 | + if (!empty($context['from_ajax'])) { |
|
190 | + echo ' |
|
185 | 191 | form.submit(function(e) { |
186 | 192 | // If we are submitting backup code, let normal workflow follow since it redirects a couple times into a different page |
187 | 193 | if (form.find("input[name=tfa_backup]:first").val().length > 0) |
@@ -200,6 +206,7 @@ discard block |
||
200 | 206 | |
201 | 207 | return false; |
202 | 208 | });'; |
209 | + } |
|
203 | 210 | |
204 | 211 | echo ' |
205 | 212 | form.find("input[name=backup]").click(function(e) { |
@@ -232,10 +239,11 @@ discard block |
||
232 | 239 | ', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br>'; |
233 | 240 | |
234 | 241 | |
235 | - if ($context['can_register']) |
|
236 | - echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']); |
|
237 | - else |
|
238 | - echo $txt['login_below']; |
|
242 | + if ($context['can_register']) { |
|
243 | + echo sprintf($txt['login_below_or_register'], $scripturl . '?action=signup', $context['forum_name_html_safe']); |
|
244 | + } else { |
|
245 | + echo $txt['login_below']; |
|
246 | + } |
|
239 | 247 | |
240 | 248 | // And now the login information. |
241 | 249 | echo ' |
@@ -335,9 +343,10 @@ discard block |
||
335 | 343 | </div> |
336 | 344 | <div class="roundframe centertext noup">'; |
337 | 345 | |
338 | - if (!empty($context['incorrect_password'])) |
|
339 | - echo ' |
|
346 | + if (!empty($context['incorrect_password'])) { |
|
347 | + echo ' |
|
340 | 348 | <div class="error">', $txt['admin_incorrect_password'], '</div>'; |
349 | + } |
|
341 | 350 | |
342 | 351 | echo ' |
343 | 352 | <strong>', $txt['password'], ':</strong> |
@@ -378,11 +387,12 @@ discard block |
||
378 | 387 | <div class="roundframe">'; |
379 | 388 | |
380 | 389 | // You didn't even have an ID? |
381 | - if (empty($context['member_id'])) |
|
382 | - echo ' |
|
390 | + if (empty($context['member_id'])) { |
|
391 | + echo ' |
|
383 | 392 | <dl> |
384 | 393 | <dt>', $txt['invalid_activation_username'], ':</dt> |
385 | 394 | <dd><input type="text" name="user" size="30"></dd>'; |
395 | + } |
|
386 | 396 | |
387 | 397 | echo ' |
388 | 398 | <dt>', $txt['invalid_activation_retry'], ':</dt> |
@@ -419,13 +429,14 @@ discard block |
||
419 | 429 | <dd><input type="password" name="passwd" size="30"></dd> |
420 | 430 | </dl>'; |
421 | 431 | |
422 | - if ($context['can_activate']) |
|
423 | - echo ' |
|
432 | + if ($context['can_activate']) { |
|
433 | + echo ' |
|
424 | 434 | <p>', $txt['invalid_activation_known'], '</p> |
425 | 435 | <dl> |
426 | 436 | <dt>', $txt['invalid_activation_retry'], ':</dt> |
427 | 437 | <dd><input type="text" name="code" size="30"></dd> |
428 | 438 | </dl>'; |
439 | + } |
|
429 | 440 | |
430 | 441 | echo ' |
431 | 442 | <p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button"></p> |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | |
255 | 255 | case 'datetime': |
256 | 256 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
257 | - return 'str_to_date('. |
|
258 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
257 | + return 'str_to_date(' . |
|
258 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
259 | 259 | ',\'%Y-%m-%d %h:%i:%s\')'; |
260 | 260 | else |
261 | 261 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | { |
840 | 840 | $count = count($insertRows); |
841 | 841 | $ai = 0; |
842 | - for($i = 0; $i < $count; $i++) |
|
842 | + for ($i = 0; $i < $count; $i++) |
|
843 | 843 | { |
844 | 844 | $old_id = $smcFunc['db_insert_id'](); |
845 | 845 | |
@@ -865,13 +865,13 @@ discard block |
||
865 | 865 | $count2 = count($indexed_columns); |
866 | 866 | for ($x = 0; $x < $count2; $x++) |
867 | 867 | { |
868 | - $where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x]; |
|
868 | + $where_string += key($indexed_columns[$x]) . ' = ' . $insertRows[$i][$x]; |
|
869 | 869 | if (($x + 1) < $count2) |
870 | 870 | $where_string += ' AND '; |
871 | 871 | } |
872 | 872 | |
873 | - $request = $smcFunc['db_query']('',' |
|
874 | - SELECT `'. $keys[0] . '` FROM ' . $table .' |
|
873 | + $request = $smcFunc['db_query']('', ' |
|
874 | + SELECT `'. $keys[0] . '` FROM ' . $table . ' |
|
875 | 875 | WHERE ' . $where_string . ' LIMIT 1', |
876 | 876 | array() |
877 | 877 | ); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | $return_var = array(); |
901 | 901 | $count = count($insertRows); |
902 | 902 | $start = smf_db_insert_id($table, $keys[0]); |
903 | - for ($i = 0; $i < $count; $i++ ) |
|
903 | + for ($i = 0; $i < $count; $i++) |
|
904 | 904 | $return_var[] = $start + $i; |
905 | 905 | } |
906 | 906 | return $return_var; |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssi', |
1031 | 1031 | $error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6], |
1032 | 1032 | $error_array[7], $error_array[8]); |
1033 | - mysqli_stmt_execute ($mysql_error_data_prep); |
|
1033 | + mysqli_stmt_execute($mysql_error_data_prep); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | ?> |
1037 | 1037 | \ No newline at end of file |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Maps the implementations in this file (smf_db_function_name) |
@@ -33,8 +34,8 @@ discard block |
||
33 | 34 | global $smcFunc; |
34 | 35 | |
35 | 36 | // Map some database specific functions, only do this once. |
36 | - if (!isset($smcFunc['db_fetch_assoc'])) |
|
37 | - $smcFunc += array( |
|
37 | + if (!isset($smcFunc['db_fetch_assoc'])) { |
|
38 | + $smcFunc += array( |
|
38 | 39 | 'db_query' => 'smf_db_query', |
39 | 40 | 'db_quote' => 'smf_db_quote', |
40 | 41 | 'db_fetch_assoc' => 'mysqli_fetch_assoc', |
@@ -62,9 +63,11 @@ discard block |
||
62 | 63 | 'db_fetch_all' => 'smf_db_fetch_all', |
63 | 64 | 'db_error_insert' => 'smf_db_error_insert', |
64 | 65 | ); |
66 | + } |
|
65 | 67 | |
66 | - if (!empty($db_options['persist'])) |
|
67 | - $db_server = 'p:' . $db_server; |
|
68 | + if (!empty($db_options['persist'])) { |
|
69 | + $db_server = 'p:' . $db_server; |
|
70 | + } |
|
68 | 71 | |
69 | 72 | $connection = mysqli_init(); |
70 | 73 | |
@@ -73,24 +76,27 @@ discard block |
||
73 | 76 | $success = false; |
74 | 77 | |
75 | 78 | if ($connection) { |
76 | - if (!empty($db_options['port'])) |
|
77 | - $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', $db_options['port'], null, $flags); |
|
78 | - else |
|
79 | - $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', 0, null, $flags); |
|
79 | + if (!empty($db_options['port'])) { |
|
80 | + $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', $db_options['port'], null, $flags); |
|
81 | + } else { |
|
82 | + $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', 0, null, $flags); |
|
83 | + } |
|
80 | 84 | } |
81 | 85 | |
82 | 86 | // Something's wrong, show an error if its fatal (which we assume it is) |
83 | 87 | if ($success === false) |
84 | 88 | { |
85 | - if (!empty($db_options['non_fatal'])) |
|
86 | - return null; |
|
87 | - else |
|
88 | - display_db_error(); |
|
89 | + if (!empty($db_options['non_fatal'])) { |
|
90 | + return null; |
|
91 | + } else { |
|
92 | + display_db_error(); |
|
93 | + } |
|
89 | 94 | } |
90 | 95 | |
91 | 96 | // Select the database, unless told not to |
92 | - if (empty($db_options['dont_select_db']) && !@mysqli_select_db($connection, $db_name) && empty($db_options['non_fatal'])) |
|
93 | - display_db_error(); |
|
97 | + if (empty($db_options['dont_select_db']) && !@mysqli_select_db($connection, $db_name) && empty($db_options['non_fatal'])) { |
|
98 | + display_db_error(); |
|
99 | + } |
|
94 | 100 | |
95 | 101 | $smcFunc['db_query']('', 'SET SESSION sql_mode = \'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\'', |
96 | 102 | array(), |
@@ -166,34 +172,42 @@ discard block |
||
166 | 172 | global $db_callback, $user_info, $db_prefix, $smcFunc; |
167 | 173 | |
168 | 174 | list ($values, $connection) = $db_callback; |
169 | - if (!is_object($connection)) |
|
170 | - display_db_error(); |
|
175 | + if (!is_object($connection)) { |
|
176 | + display_db_error(); |
|
177 | + } |
|
171 | 178 | |
172 | - if ($matches[1] === 'db_prefix') |
|
173 | - return $db_prefix; |
|
179 | + if ($matches[1] === 'db_prefix') { |
|
180 | + return $db_prefix; |
|
181 | + } |
|
174 | 182 | |
175 | - if (isset($user_info[$matches[1]]) && strpos($matches[1], 'query_') !== false) |
|
176 | - return $user_info[$matches[1]]; |
|
183 | + if (isset($user_info[$matches[1]]) && strpos($matches[1], 'query_') !== false) { |
|
184 | + return $user_info[$matches[1]]; |
|
185 | + } |
|
177 | 186 | |
178 | - if ($matches[1] === 'empty') |
|
179 | - return '\'\''; |
|
187 | + if ($matches[1] === 'empty') { |
|
188 | + return '\'\''; |
|
189 | + } |
|
180 | 190 | |
181 | - if (!isset($matches[2])) |
|
182 | - smf_db_error_backtrace('Invalid value inserted or no type specified.', '', E_USER_ERROR, __FILE__, __LINE__); |
|
191 | + if (!isset($matches[2])) { |
|
192 | + smf_db_error_backtrace('Invalid value inserted or no type specified.', '', E_USER_ERROR, __FILE__, __LINE__); |
|
193 | + } |
|
183 | 194 | |
184 | - if ($matches[1] === 'literal') |
|
185 | - return '\'' . mysqli_real_escape_string($connection, $matches[2]) . '\''; |
|
195 | + if ($matches[1] === 'literal') { |
|
196 | + return '\'' . mysqli_real_escape_string($connection, $matches[2]) . '\''; |
|
197 | + } |
|
186 | 198 | |
187 | - if (!isset($values[$matches[2]])) |
|
188 | - smf_db_error_backtrace('The database value you\'re trying to insert does not exist: ' . (isset($smcFunc['htmlspecialchars']) ? $smcFunc['htmlspecialchars']($matches[2]) : htmlspecialchars($matches[2])), '', E_USER_ERROR, __FILE__, __LINE__); |
|
199 | + if (!isset($values[$matches[2]])) { |
|
200 | + smf_db_error_backtrace('The database value you\'re trying to insert does not exist: ' . (isset($smcFunc['htmlspecialchars']) ? $smcFunc['htmlspecialchars']($matches[2]) : htmlspecialchars($matches[2])), '', E_USER_ERROR, __FILE__, __LINE__); |
|
201 | + } |
|
189 | 202 | |
190 | 203 | $replacement = $values[$matches[2]]; |
191 | 204 | |
192 | 205 | switch ($matches[1]) |
193 | 206 | { |
194 | 207 | case 'int': |
195 | - if (!is_numeric($replacement) || (string) $replacement !== (string) (int) $replacement) |
|
196 | - smf_db_error_backtrace('Wrong value type sent to the database. Integer expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
208 | + if (!is_numeric($replacement) || (string) $replacement !== (string) (int) $replacement) { |
|
209 | + smf_db_error_backtrace('Wrong value type sent to the database. Integer expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
210 | + } |
|
197 | 211 | return (string) (int) $replacement; |
198 | 212 | break; |
199 | 213 | |
@@ -205,65 +219,73 @@ discard block |
||
205 | 219 | case 'array_int': |
206 | 220 | if (is_array($replacement)) |
207 | 221 | { |
208 | - if (empty($replacement)) |
|
209 | - smf_db_error_backtrace('Database error, given array of integer values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
222 | + if (empty($replacement)) { |
|
223 | + smf_db_error_backtrace('Database error, given array of integer values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
224 | + } |
|
210 | 225 | |
211 | 226 | foreach ($replacement as $key => $value) |
212 | 227 | { |
213 | - if (!is_numeric($value) || (string) $value !== (string) (int) $value) |
|
214 | - smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
228 | + if (!is_numeric($value) || (string) $value !== (string) (int) $value) { |
|
229 | + smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
230 | + } |
|
215 | 231 | |
216 | 232 | $replacement[$key] = (string) (int) $value; |
217 | 233 | } |
218 | 234 | |
219 | 235 | return implode(', ', $replacement); |
236 | + } else { |
|
237 | + smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
220 | 238 | } |
221 | - else |
|
222 | - smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
223 | 239 | |
224 | 240 | break; |
225 | 241 | |
226 | 242 | case 'array_string': |
227 | 243 | if (is_array($replacement)) |
228 | 244 | { |
229 | - if (empty($replacement)) |
|
230 | - smf_db_error_backtrace('Database error, given array of string values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
245 | + if (empty($replacement)) { |
|
246 | + smf_db_error_backtrace('Database error, given array of string values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
247 | + } |
|
231 | 248 | |
232 | - foreach ($replacement as $key => $value) |
|
233 | - $replacement[$key] = sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $value)); |
|
249 | + foreach ($replacement as $key => $value) { |
|
250 | + $replacement[$key] = sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $value)); |
|
251 | + } |
|
234 | 252 | |
235 | 253 | return implode(', ', $replacement); |
254 | + } else { |
|
255 | + smf_db_error_backtrace('Wrong value type sent to the database. Array of strings expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
236 | 256 | } |
237 | - else |
|
238 | - smf_db_error_backtrace('Wrong value type sent to the database. Array of strings expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
239 | 257 | break; |
240 | 258 | |
241 | 259 | case 'date': |
242 | - if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
|
243 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]); |
|
244 | - else |
|
245 | - smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
260 | + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) { |
|
261 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]); |
|
262 | + } else { |
|
263 | + smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
264 | + } |
|
246 | 265 | break; |
247 | 266 | |
248 | 267 | case 'time': |
249 | - if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
|
250 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]); |
|
251 | - else |
|
252 | - smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
268 | + if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) { |
|
269 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]); |
|
270 | + } else { |
|
271 | + smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
272 | + } |
|
253 | 273 | break; |
254 | 274 | |
255 | 275 | case 'datetime': |
256 | - if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
|
257 | - return 'str_to_date('. |
|
276 | + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) { |
|
277 | + return 'str_to_date('. |
|
258 | 278 | sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
259 | 279 | ',\'%Y-%m-%d %h:%i:%s\')'; |
260 | - else |
|
261 | - smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
280 | + } else { |
|
281 | + smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
282 | + } |
|
262 | 283 | break; |
263 | 284 | |
264 | 285 | case 'float': |
265 | - if (!is_numeric($replacement)) |
|
266 | - smf_db_error_backtrace('Wrong value type sent to the database. Floating point number expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
286 | + if (!is_numeric($replacement)) { |
|
287 | + smf_db_error_backtrace('Wrong value type sent to the database. Floating point number expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
288 | + } |
|
267 | 289 | return (string) (float) $replacement; |
268 | 290 | break; |
269 | 291 | |
@@ -277,32 +299,37 @@ discard block |
||
277 | 299 | break; |
278 | 300 | |
279 | 301 | case 'inet': |
280 | - if ($replacement == 'null' || $replacement == '') |
|
281 | - return 'null'; |
|
282 | - if (!isValidIP($replacement)) |
|
283 | - smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
302 | + if ($replacement == 'null' || $replacement == '') { |
|
303 | + return 'null'; |
|
304 | + } |
|
305 | + if (!isValidIP($replacement)) { |
|
306 | + smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
307 | + } |
|
284 | 308 | //we don't use the native support of mysql > 5.6.2 |
285 | 309 | return sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($replacement))); |
286 | 310 | |
287 | 311 | case 'array_inet': |
288 | 312 | if (is_array($replacement)) |
289 | 313 | { |
290 | - if (empty($replacement)) |
|
291 | - smf_db_error_backtrace('Database error, given array of IPv4 or IPv6 values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
314 | + if (empty($replacement)) { |
|
315 | + smf_db_error_backtrace('Database error, given array of IPv4 or IPv6 values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
316 | + } |
|
292 | 317 | |
293 | 318 | foreach ($replacement as $key => $value) |
294 | 319 | { |
295 | - if ($replacement == 'null' || $replacement == '') |
|
296 | - $replacement[$key] = 'null'; |
|
297 | - if (!isValidIP($value)) |
|
298 | - smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
320 | + if ($replacement == 'null' || $replacement == '') { |
|
321 | + $replacement[$key] = 'null'; |
|
322 | + } |
|
323 | + if (!isValidIP($value)) { |
|
324 | + smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
325 | + } |
|
299 | 326 | $replacement[$key] = sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($value))); |
300 | 327 | } |
301 | 328 | |
302 | 329 | return implode(', ', $replacement); |
330 | + } else { |
|
331 | + smf_db_error_backtrace('Wrong value type sent to the database. Array of IPv4 or IPv6 expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
303 | 332 | } |
304 | - else |
|
305 | - smf_db_error_backtrace('Wrong value type sent to the database. Array of IPv4 or IPv6 expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
306 | 333 | break; |
307 | 334 | |
308 | 335 | default: |
@@ -378,22 +405,25 @@ discard block |
||
378 | 405 | // Are we in SSI mode? If so try that username and password first |
379 | 406 | if (SMF == 'SSI' && !empty($ssi_db_user) && !empty($ssi_db_passwd)) |
380 | 407 | { |
381 | - if (empty($db_persist)) |
|
382 | - $db_connection = @mysqli_connect($db_server, $ssi_db_user, $ssi_db_passwd); |
|
383 | - else |
|
384 | - $db_connection = @mysqli_connect('p:' . $db_server, $ssi_db_user, $ssi_db_passwd); |
|
408 | + if (empty($db_persist)) { |
|
409 | + $db_connection = @mysqli_connect($db_server, $ssi_db_user, $ssi_db_passwd); |
|
410 | + } else { |
|
411 | + $db_connection = @mysqli_connect('p:' . $db_server, $ssi_db_user, $ssi_db_passwd); |
|
412 | + } |
|
385 | 413 | } |
386 | 414 | // Fall back to the regular username and password if need be |
387 | 415 | if (!$db_connection) |
388 | 416 | { |
389 | - if (empty($db_persist)) |
|
390 | - $db_connection = @mysqli_connect($db_server, $db_user, $db_passwd); |
|
391 | - else |
|
392 | - $db_connection = @mysqli_connect('p:' . $db_server, $db_user, $db_passwd); |
|
417 | + if (empty($db_persist)) { |
|
418 | + $db_connection = @mysqli_connect($db_server, $db_user, $db_passwd); |
|
419 | + } else { |
|
420 | + $db_connection = @mysqli_connect('p:' . $db_server, $db_user, $db_passwd); |
|
421 | + } |
|
393 | 422 | } |
394 | 423 | |
395 | - if (!$db_connection || !@mysqli_select_db($db_connection, $db_name)) |
|
396 | - $db_connection = false; |
|
424 | + if (!$db_connection || !@mysqli_select_db($db_connection, $db_name)) { |
|
425 | + $db_connection = false; |
|
426 | + } |
|
397 | 427 | |
398 | 428 | $connection = $db_connection; |
399 | 429 | } |
@@ -401,18 +431,20 @@ discard block |
||
401 | 431 | // One more query.... |
402 | 432 | $db_count = !isset($db_count) ? 1 : $db_count + 1; |
403 | 433 | |
404 | - if (empty($modSettings['disableQueryCheck']) && strpos($db_string, '\'') !== false && empty($db_values['security_override'])) |
|
405 | - smf_db_error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__); |
|
434 | + if (empty($modSettings['disableQueryCheck']) && strpos($db_string, '\'') !== false && empty($db_values['security_override'])) { |
|
435 | + smf_db_error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__); |
|
436 | + } |
|
406 | 437 | |
407 | 438 | // Use "ORDER BY null" to prevent Mysql doing filesorts for Group By clauses without an Order By |
408 | 439 | if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && preg_match('~^\s+SELECT~i', $db_string)) |
409 | 440 | { |
410 | 441 | // Add before LIMIT |
411 | - if ($pos = strpos($db_string, 'LIMIT ')) |
|
412 | - $db_string = substr($db_string, 0, $pos) . "\t\t\tORDER BY null\n" . substr($db_string, $pos, strlen($db_string)); |
|
413 | - else |
|
414 | - // Append it. |
|
442 | + if ($pos = strpos($db_string, 'LIMIT ')) { |
|
443 | + $db_string = substr($db_string, 0, $pos) . "\t\t\tORDER BY null\n" . substr($db_string, $pos, strlen($db_string)); |
|
444 | + } else { |
|
445 | + // Append it. |
|
415 | 446 | $db_string .= "\n\t\t\tORDER BY null"; |
447 | + } |
|
416 | 448 | } |
417 | 449 | |
418 | 450 | if (empty($db_values['security_override']) && (!empty($db_values) || strpos($db_string, '{db_prefix}') !== false)) |
@@ -434,8 +466,9 @@ discard block |
||
434 | 466 | list ($file, $line) = smf_db_error_backtrace('', '', 'return', __FILE__, __LINE__); |
435 | 467 | |
436 | 468 | // Initialize $db_cache if not already initialized. |
437 | - if (!isset($db_cache)) |
|
438 | - $db_cache = array(); |
|
469 | + if (!isset($db_cache)) { |
|
470 | + $db_cache = array(); |
|
471 | + } |
|
439 | 472 | |
440 | 473 | if (!empty($_SESSION['debug_redirect'])) |
441 | 474 | { |
@@ -461,17 +494,18 @@ discard block |
||
461 | 494 | while (true) |
462 | 495 | { |
463 | 496 | $pos = strpos($db_string, '\'', $pos + 1); |
464 | - if ($pos === false) |
|
465 | - break; |
|
497 | + if ($pos === false) { |
|
498 | + break; |
|
499 | + } |
|
466 | 500 | $clean .= substr($db_string, $old_pos, $pos - $old_pos); |
467 | 501 | |
468 | 502 | while (true) |
469 | 503 | { |
470 | 504 | $pos1 = strpos($db_string, '\'', $pos + 1); |
471 | 505 | $pos2 = strpos($db_string, '\\', $pos + 1); |
472 | - if ($pos1 === false) |
|
473 | - break; |
|
474 | - elseif ($pos2 === false || $pos2 > $pos1) |
|
506 | + if ($pos1 === false) { |
|
507 | + break; |
|
508 | + } elseif ($pos2 === false || $pos2 > $pos1) |
|
475 | 509 | { |
476 | 510 | $pos = $pos1; |
477 | 511 | break; |
@@ -487,29 +521,35 @@ discard block |
||
487 | 521 | $clean = trim(strtolower(preg_replace($allowed_comments_from, $allowed_comments_to, $clean))); |
488 | 522 | |
489 | 523 | // Comments? We don't use comments in our queries, we leave 'em outside! |
490 | - if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false) |
|
491 | - $fail = true; |
|
524 | + if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false) { |
|
525 | + $fail = true; |
|
526 | + } |
|
492 | 527 | // Trying to change passwords, slow us down, or something? |
493 | - elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0) |
|
494 | - $fail = true; |
|
495 | - elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) |
|
496 | - $fail = true; |
|
528 | + elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0) { |
|
529 | + $fail = true; |
|
530 | + } elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) { |
|
531 | + $fail = true; |
|
532 | + } |
|
497 | 533 | |
498 | - if (!empty($fail) && function_exists('log_error')) |
|
499 | - smf_db_error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__); |
|
534 | + if (!empty($fail) && function_exists('log_error')) { |
|
535 | + smf_db_error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__); |
|
536 | + } |
|
500 | 537 | } |
501 | 538 | |
502 | - if (empty($db_unbuffered)) |
|
503 | - $ret = @mysqli_query($connection, $db_string); |
|
504 | - else |
|
505 | - $ret = @mysqli_query($connection, $db_string, MYSQLI_USE_RESULT); |
|
539 | + if (empty($db_unbuffered)) { |
|
540 | + $ret = @mysqli_query($connection, $db_string); |
|
541 | + } else { |
|
542 | + $ret = @mysqli_query($connection, $db_string, MYSQLI_USE_RESULT); |
|
543 | + } |
|
506 | 544 | |
507 | - if ($ret === false && empty($db_values['db_error_skip'])) |
|
508 | - $ret = smf_db_error($db_string, $connection); |
|
545 | + if ($ret === false && empty($db_values['db_error_skip'])) { |
|
546 | + $ret = smf_db_error($db_string, $connection); |
|
547 | + } |
|
509 | 548 | |
510 | 549 | // Debugging. |
511 | - if (isset($db_show_debug) && $db_show_debug === true) |
|
512 | - $db_cache[$db_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)); |
|
550 | + if (isset($db_show_debug) && $db_show_debug === true) { |
|
551 | + $db_cache[$db_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)); |
|
552 | + } |
|
513 | 553 | |
514 | 554 | return $ret; |
515 | 555 | } |
@@ -556,12 +596,13 @@ discard block |
||
556 | 596 | // Decide which connection to use |
557 | 597 | $connection = $connection === null ? $db_connection : $connection; |
558 | 598 | |
559 | - if ($type == 'begin') |
|
560 | - return @mysqli_query($connection, 'BEGIN'); |
|
561 | - elseif ($type == 'rollback') |
|
562 | - return @mysqli_query($connection, 'ROLLBACK'); |
|
563 | - elseif ($type == 'commit') |
|
564 | - return @mysqli_query($connection, 'COMMIT'); |
|
599 | + if ($type == 'begin') { |
|
600 | + return @mysqli_query($connection, 'BEGIN'); |
|
601 | + } elseif ($type == 'rollback') { |
|
602 | + return @mysqli_query($connection, 'ROLLBACK'); |
|
603 | + } elseif ($type == 'commit') { |
|
604 | + return @mysqli_query($connection, 'COMMIT'); |
|
605 | + } |
|
565 | 606 | |
566 | 607 | return false; |
567 | 608 | } |
@@ -601,8 +642,9 @@ discard block |
||
601 | 642 | // 2013: Lost connection to server during query. |
602 | 643 | |
603 | 644 | // Log the error. |
604 | - if ($query_errno != 1213 && $query_errno != 1205 && function_exists('log_error')) |
|
605 | - log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n$db_string" : ''), 'database', $file, $line); |
|
645 | + if ($query_errno != 1213 && $query_errno != 1205 && function_exists('log_error')) { |
|
646 | + log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n$db_string" : ''), 'database', $file, $line); |
|
647 | + } |
|
606 | 648 | |
607 | 649 | // Database error auto fixing ;). |
608 | 650 | if (function_exists('cache_get_data') && (!isset($modSettings['autoFixDatabase']) || $modSettings['autoFixDatabase'] == '1')) |
@@ -611,8 +653,9 @@ discard block |
||
611 | 653 | $old_cache = @$modSettings['cache_enable']; |
612 | 654 | $modSettings['cache_enable'] = '1'; |
613 | 655 | |
614 | - if (($temp = cache_get_data('db_last_error', 600)) !== null) |
|
615 | - $db_last_error = max(@$db_last_error, $temp); |
|
656 | + if (($temp = cache_get_data('db_last_error', 600)) !== null) { |
|
657 | + $db_last_error = max(@$db_last_error, $temp); |
|
658 | + } |
|
616 | 659 | |
617 | 660 | if (@$db_last_error < time() - 3600 * 24 * 3) |
618 | 661 | { |
@@ -628,8 +671,9 @@ discard block |
||
628 | 671 | foreach ($tables as $table) |
629 | 672 | { |
630 | 673 | // Now, it's still theoretically possible this could be an injection. So backtick it! |
631 | - if (trim($table) != '') |
|
632 | - $fix_tables[] = '`' . strtr(trim($table), array('`' => '')) . '`'; |
|
674 | + if (trim($table) != '') { |
|
675 | + $fix_tables[] = '`' . strtr(trim($table), array('`' => '')) . '`'; |
|
676 | + } |
|
633 | 677 | } |
634 | 678 | } |
635 | 679 | |
@@ -638,8 +682,9 @@ discard block |
||
638 | 682 | // Table crashed. Let's try to fix it. |
639 | 683 | elseif ($query_errno == 1016) |
640 | 684 | { |
641 | - if (preg_match('~\'([^\.\']+)~', $query_error, $match) != 0) |
|
642 | - $fix_tables = array('`' . $match[1] . '`'); |
|
685 | + if (preg_match('~\'([^\.\']+)~', $query_error, $match) != 0) { |
|
686 | + $fix_tables = array('`' . $match[1] . '`'); |
|
687 | + } |
|
643 | 688 | } |
644 | 689 | // Indexes crashed. Should be easy to fix! |
645 | 690 | elseif ($query_errno == 1034 || $query_errno == 1035) |
@@ -658,13 +703,15 @@ discard block |
||
658 | 703 | |
659 | 704 | // Make a note of the REPAIR... |
660 | 705 | cache_put_data('db_last_error', time(), 600); |
661 | - if (($temp = cache_get_data('db_last_error', 600)) === null) |
|
662 | - updateSettingsFile(array('db_last_error' => time())); |
|
706 | + if (($temp = cache_get_data('db_last_error', 600)) === null) { |
|
707 | + updateSettingsFile(array('db_last_error' => time())); |
|
708 | + } |
|
663 | 709 | |
664 | 710 | // Attempt to find and repair the broken table. |
665 | - foreach ($fix_tables as $table) |
|
666 | - $smcFunc['db_query']('', " |
|
711 | + foreach ($fix_tables as $table) { |
|
712 | + $smcFunc['db_query']('', " |
|
667 | 713 | REPAIR TABLE $table", false, false); |
714 | + } |
|
668 | 715 | |
669 | 716 | // And send off an email! |
670 | 717 | sendmail($webmaster_email, $txt['database_error'], $txt['tried_to_repair'], null, 'dberror'); |
@@ -673,11 +720,12 @@ discard block |
||
673 | 720 | |
674 | 721 | // Try the query again...? |
675 | 722 | $ret = $smcFunc['db_query']('', $db_string, false, false); |
676 | - if ($ret !== false) |
|
677 | - return $ret; |
|
723 | + if ($ret !== false) { |
|
724 | + return $ret; |
|
725 | + } |
|
726 | + } else { |
|
727 | + $modSettings['cache_enable'] = $old_cache; |
|
678 | 728 | } |
679 | - else |
|
680 | - $modSettings['cache_enable'] = $old_cache; |
|
681 | 729 | |
682 | 730 | // Check for the "lost connection" or "deadlock found" errors - and try it just one more time. |
683 | 731 | if (in_array($query_errno, array(1205, 1213, 2006, 2013))) |
@@ -687,22 +735,25 @@ discard block |
||
687 | 735 | // Are we in SSI mode? If so try that username and password first |
688 | 736 | if (SMF == 'SSI' && !empty($ssi_db_user) && !empty($ssi_db_passwd)) |
689 | 737 | { |
690 | - if (empty($db_persist)) |
|
691 | - $db_connection = @mysqli_connect($db_server, $ssi_db_user, $ssi_db_passwd); |
|
692 | - else |
|
693 | - $db_connection = @mysqli_connect('p:' . $db_server, $ssi_db_user, $ssi_db_passwd); |
|
738 | + if (empty($db_persist)) { |
|
739 | + $db_connection = @mysqli_connect($db_server, $ssi_db_user, $ssi_db_passwd); |
|
740 | + } else { |
|
741 | + $db_connection = @mysqli_connect('p:' . $db_server, $ssi_db_user, $ssi_db_passwd); |
|
742 | + } |
|
694 | 743 | } |
695 | 744 | // Fall back to the regular username and password if need be |
696 | 745 | if (!$db_connection) |
697 | 746 | { |
698 | - if (empty($db_persist)) |
|
699 | - $db_connection = @mysqli_connect($db_server, $db_user, $db_passwd); |
|
700 | - else |
|
701 | - $db_connection = @mysqli_connect('p:' . $db_server, $db_user, $db_passwd); |
|
747 | + if (empty($db_persist)) { |
|
748 | + $db_connection = @mysqli_connect($db_server, $db_user, $db_passwd); |
|
749 | + } else { |
|
750 | + $db_connection = @mysqli_connect('p:' . $db_server, $db_user, $db_passwd); |
|
751 | + } |
|
702 | 752 | } |
703 | 753 | |
704 | - if (!$db_connection || !@mysqli_select_db($db_connection, $db_name)) |
|
705 | - $db_connection = false; |
|
754 | + if (!$db_connection || !@mysqli_select_db($db_connection, $db_name)) { |
|
755 | + $db_connection = false; |
|
756 | + } |
|
706 | 757 | } |
707 | 758 | |
708 | 759 | if ($db_connection) |
@@ -713,24 +764,27 @@ discard block |
||
713 | 764 | $ret = $smcFunc['db_query']('', $db_string, false, false); |
714 | 765 | |
715 | 766 | $new_errno = mysqli_errno($db_connection); |
716 | - if ($ret !== false || in_array($new_errno, array(1205, 1213))) |
|
717 | - break; |
|
767 | + if ($ret !== false || in_array($new_errno, array(1205, 1213))) { |
|
768 | + break; |
|
769 | + } |
|
718 | 770 | } |
719 | 771 | |
720 | 772 | // If it failed again, shucks to be you... we're not trying it over and over. |
721 | - if ($ret !== false) |
|
722 | - return $ret; |
|
773 | + if ($ret !== false) { |
|
774 | + return $ret; |
|
775 | + } |
|
723 | 776 | } |
724 | 777 | } |
725 | 778 | // Are they out of space, perhaps? |
726 | 779 | elseif ($query_errno == 1030 && (strpos($query_error, ' -1 ') !== false || strpos($query_error, ' 28 ') !== false || strpos($query_error, ' 12 ') !== false)) |
727 | 780 | { |
728 | - if (!isset($txt)) |
|
729 | - $query_error .= ' - check database storage space.'; |
|
730 | - else |
|
781 | + if (!isset($txt)) { |
|
782 | + $query_error .= ' - check database storage space.'; |
|
783 | + } else |
|
731 | 784 | { |
732 | - if (!isset($txt['mysql_error_space'])) |
|
733 | - loadLanguage('Errors'); |
|
785 | + if (!isset($txt['mysql_error_space'])) { |
|
786 | + loadLanguage('Errors'); |
|
787 | + } |
|
734 | 788 | |
735 | 789 | $query_error .= !isset($txt['mysql_error_space']) ? ' - check database storage space.' : $txt['mysql_error_space']; |
736 | 790 | } |
@@ -738,15 +792,17 @@ discard block |
||
738 | 792 | } |
739 | 793 | |
740 | 794 | // Nothing's defined yet... just die with it. |
741 | - if (empty($context) || empty($txt)) |
|
742 | - die($query_error); |
|
795 | + if (empty($context) || empty($txt)) { |
|
796 | + die($query_error); |
|
797 | + } |
|
743 | 798 | |
744 | 799 | // Show an error message, if possible. |
745 | 800 | $context['error_title'] = $txt['database_error']; |
746 | - if (allowedTo('admin_forum')) |
|
747 | - $context['error_message'] = nl2br($query_error) . '<br>' . $txt['file'] . ': ' . $file . '<br>' . $txt['line'] . ': ' . $line; |
|
748 | - else |
|
749 | - $context['error_message'] = $txt['try_again']; |
|
801 | + if (allowedTo('admin_forum')) { |
|
802 | + $context['error_message'] = nl2br($query_error) . '<br>' . $txt['file'] . ': ' . $file . '<br>' . $txt['line'] . ': ' . $line; |
|
803 | + } else { |
|
804 | + $context['error_message'] = $txt['try_again']; |
|
805 | + } |
|
750 | 806 | |
751 | 807 | if (allowedTo('admin_forum') && isset($db_show_debug) && $db_show_debug === true) |
752 | 808 | { |
@@ -778,8 +834,9 @@ discard block |
||
778 | 834 | $return_var = null; |
779 | 835 | |
780 | 836 | // With nothing to insert, simply return. |
781 | - if (empty($data)) |
|
782 | - return; |
|
837 | + if (empty($data)) { |
|
838 | + return; |
|
839 | + } |
|
783 | 840 | |
784 | 841 | // Replace the prefix holder with the actual prefix. |
785 | 842 | $table = str_replace('{db_prefix}', $db_prefix, $table); |
@@ -789,23 +846,26 @@ discard block |
||
789 | 846 | if (!empty($keys) && (count($keys) > 0) && $returnmode > 0) |
790 | 847 | { |
791 | 848 | $with_returning = true; |
792 | - if ($returnmode == 2) |
|
793 | - $return_var = array(); |
|
849 | + if ($returnmode == 2) { |
|
850 | + $return_var = array(); |
|
851 | + } |
|
794 | 852 | } |
795 | 853 | |
796 | 854 | // Inserting data as a single row can be done as a single array. |
797 | - if (!is_array($data[array_rand($data)])) |
|
798 | - $data = array($data); |
|
855 | + if (!is_array($data[array_rand($data)])) { |
|
856 | + $data = array($data); |
|
857 | + } |
|
799 | 858 | |
800 | 859 | // Create the mold for a single row insert. |
801 | 860 | $insertData = '('; |
802 | 861 | foreach ($columns as $columnName => $type) |
803 | 862 | { |
804 | 863 | // Are we restricting the length? |
805 | - if (strpos($type, 'string-') !== false) |
|
806 | - $insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName); |
|
807 | - else |
|
808 | - $insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName); |
|
864 | + if (strpos($type, 'string-') !== false) { |
|
865 | + $insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName); |
|
866 | + } else { |
|
867 | + $insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName); |
|
868 | + } |
|
809 | 869 | } |
810 | 870 | $insertData = substr($insertData, 0, -2) . ')'; |
811 | 871 | |
@@ -814,8 +874,9 @@ discard block |
||
814 | 874 | |
815 | 875 | // Here's where the variables are injected to the query. |
816 | 876 | $insertRows = array(); |
817 | - foreach ($data as $dataRow) |
|
818 | - $insertRows[] = smf_db_quote($insertData, array_combine($indexed_columns, $dataRow), $connection); |
|
877 | + foreach ($data as $dataRow) { |
|
878 | + $insertRows[] = smf_db_quote($insertData, array_combine($indexed_columns, $dataRow), $connection); |
|
879 | + } |
|
819 | 880 | |
820 | 881 | // Determine the method of insertion. |
821 | 882 | $queryTitle = $method == 'replace' ? 'REPLACE' : ($method == 'ignore' ? 'INSERT IGNORE' : 'INSERT'); |
@@ -834,8 +895,7 @@ discard block |
||
834 | 895 | ), |
835 | 896 | $connection |
836 | 897 | ); |
837 | - } |
|
838 | - else //special way for ignore method with returning |
|
898 | + } else //special way for ignore method with returning |
|
839 | 899 | { |
840 | 900 | $count = count($insertRows); |
841 | 901 | $ai = 0; |
@@ -855,19 +915,21 @@ discard block |
||
855 | 915 | ); |
856 | 916 | $new_id = $smcFunc['db_insert_id'](); |
857 | 917 | |
858 | - if ($last_id != $new_id) //the inserted value was new |
|
918 | + if ($last_id != $new_id) { |
|
919 | + //the inserted value was new |
|
859 | 920 | { |
860 | 921 | $ai = $new_id; |
861 | 922 | } |
862 | - else // the inserted value already exists we need to find the pk |
|
923 | + } else // the inserted value already exists we need to find the pk |
|
863 | 924 | { |
864 | 925 | $where_string = ''; |
865 | 926 | $count2 = count($indexed_columns); |
866 | 927 | for ($x = 0; $x < $count2; $x++) |
867 | 928 | { |
868 | 929 | $where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x]; |
869 | - if (($x + 1) < $count2) |
|
870 | - $where_string += ' AND '; |
|
930 | + if (($x + 1) < $count2) { |
|
931 | + $where_string += ' AND '; |
|
932 | + } |
|
871 | 933 | } |
872 | 934 | |
873 | 935 | $request = $smcFunc['db_query']('',' |
@@ -883,25 +945,27 @@ discard block |
||
883 | 945 | } |
884 | 946 | } |
885 | 947 | |
886 | - if ($returnmode == 1) |
|
887 | - $return_var = $ai; |
|
888 | - else if ($returnmode == 2) |
|
889 | - $return_var[] = $ai; |
|
948 | + if ($returnmode == 1) { |
|
949 | + $return_var = $ai; |
|
950 | + } else if ($returnmode == 2) { |
|
951 | + $return_var[] = $ai; |
|
952 | + } |
|
890 | 953 | } |
891 | 954 | } |
892 | 955 | |
893 | 956 | |
894 | 957 | if ($with_returning) |
895 | 958 | { |
896 | - if ($returnmode == 1 && empty($return_var)) |
|
897 | - $return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1; |
|
898 | - else if ($returnmode == 2 && empty($return_var)) |
|
959 | + if ($returnmode == 1 && empty($return_var)) { |
|
960 | + $return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1; |
|
961 | + } else if ($returnmode == 2 && empty($return_var)) |
|
899 | 962 | { |
900 | 963 | $return_var = array(); |
901 | 964 | $count = count($insertRows); |
902 | 965 | $start = smf_db_insert_id($table, $keys[0]); |
903 | - for ($i = 0; $i < $count; $i++ ) |
|
904 | - $return_var[] = $start + $i; |
|
966 | + for ($i = 0; $i < $count; $i++ ) { |
|
967 | + $return_var[] = $start + $i; |
|
968 | + } |
|
905 | 969 | } |
906 | 970 | return $return_var; |
907 | 971 | } |
@@ -919,8 +983,9 @@ discard block |
||
919 | 983 | */ |
920 | 984 | function smf_db_error_backtrace($error_message, $log_message = '', $error_type = false, $file = null, $line = null) |
921 | 985 | { |
922 | - if (empty($log_message)) |
|
923 | - $log_message = $error_message; |
|
986 | + if (empty($log_message)) { |
|
987 | + $log_message = $error_message; |
|
988 | + } |
|
924 | 989 | |
925 | 990 | foreach (debug_backtrace() as $step) |
926 | 991 | { |
@@ -939,12 +1004,14 @@ discard block |
||
939 | 1004 | } |
940 | 1005 | |
941 | 1006 | // A special case - we want the file and line numbers for debugging. |
942 | - if ($error_type == 'return') |
|
943 | - return array($file, $line); |
|
1007 | + if ($error_type == 'return') { |
|
1008 | + return array($file, $line); |
|
1009 | + } |
|
944 | 1010 | |
945 | 1011 | // Is always a critical error. |
946 | - if (function_exists('log_error')) |
|
947 | - log_error($log_message, 'critical', $file, $line); |
|
1012 | + if (function_exists('log_error')) { |
|
1013 | + log_error($log_message, 'critical', $file, $line); |
|
1014 | + } |
|
948 | 1015 | |
949 | 1016 | if (function_exists('fatal_error')) |
950 | 1017 | { |
@@ -952,12 +1019,12 @@ discard block |
||
952 | 1019 | |
953 | 1020 | // Cannot continue... |
954 | 1021 | exit; |
1022 | + } elseif ($error_type) { |
|
1023 | + trigger_error($error_message . ($line !== null ? '<em>(' . basename($file) . '-' . $line . ')</em>' : ''), $error_type); |
|
1024 | + } else { |
|
1025 | + trigger_error($error_message . ($line !== null ? '<em>(' . basename($file) . '-' . $line . ')</em>' : '')); |
|
1026 | + } |
|
955 | 1027 | } |
956 | - elseif ($error_type) |
|
957 | - trigger_error($error_message . ($line !== null ? '<em>(' . basename($file) . '-' . $line . ')</em>' : ''), $error_type); |
|
958 | - else |
|
959 | - trigger_error($error_message . ($line !== null ? '<em>(' . basename($file) . '-' . $line . ')</em>' : '')); |
|
960 | -} |
|
961 | 1028 | |
962 | 1029 | /** |
963 | 1030 | * Escape the LIKE wildcards so that they match the character and not the wildcard. |
@@ -974,10 +1041,11 @@ discard block |
||
974 | 1041 | '\\' => '\\\\', |
975 | 1042 | ); |
976 | 1043 | |
977 | - if ($translate_human_wildcards) |
|
978 | - $replacements += array( |
|
1044 | + if ($translate_human_wildcards) { |
|
1045 | + $replacements += array( |
|
979 | 1046 | '*' => '%', |
980 | 1047 | ); |
1048 | + } |
|
981 | 1049 | |
982 | 1050 | return strtr($string, $replacements); |
983 | 1051 | } |
@@ -991,8 +1059,9 @@ discard block |
||
991 | 1059 | */ |
992 | 1060 | function smf_is_resource($result) |
993 | 1061 | { |
994 | - if ($result instanceof mysqli_result) |
|
995 | - return true; |
|
1062 | + if ($result instanceof mysqli_result) { |
|
1063 | + return true; |
|
1064 | + } |
|
996 | 1065 | |
997 | 1066 | return false; |
998 | 1067 | } |
@@ -1020,16 +1089,18 @@ discard block |
||
1020 | 1089 | global $db_prefix, $db_connection; |
1021 | 1090 | static $mysql_error_data_prep; |
1022 | 1091 | |
1023 | - if (empty($mysql_error_data_prep)) |
|
1024 | - $mysql_error_data_prep = mysqli_prepare($db_connection, |
|
1092 | + if (empty($mysql_error_data_prep)) { |
|
1093 | + $mysql_error_data_prep = mysqli_prepare($db_connection, |
|
1025 | 1094 | 'INSERT INTO ' . $db_prefix . 'log_errors(id_member, log_time, ip, url, message, session, error_type, file, line) |
1026 | 1095 | VALUES( ?, ?, unhex(?), ?, ?, ?, ?, ?, ?)' |
1027 | 1096 | ); |
1097 | + } |
|
1028 | 1098 | |
1029 | - if (filter_var($error_array[2], FILTER_VALIDATE_IP) !== false) |
|
1030 | - $error_array[2] = bin2hex(inet_pton($error_array[2])); |
|
1031 | - else |
|
1032 | - $error_array[2] = null; |
|
1099 | + if (filter_var($error_array[2], FILTER_VALIDATE_IP) !== false) { |
|
1100 | + $error_array[2] = bin2hex(inet_pton($error_array[2])); |
|
1101 | + } else { |
|
1102 | + $error_array[2] = null; |
|
1103 | + } |
|
1033 | 1104 | mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssi', |
1034 | 1105 | $error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6], |
1035 | 1106 | $error_array[7], $error_array[8]); |
@@ -28,14 +28,15 @@ discard block |
||
28 | 28 | <div id="confirm_buttons">'; |
29 | 29 | |
30 | 30 | // Age restriction in effect? |
31 | - if ($context['show_coppa']) |
|
32 | - echo ' |
|
31 | + if ($context['show_coppa']) { |
|
32 | + echo ' |
|
33 | 33 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
34 | 34 | <br> |
35 | 35 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
36 | - else |
|
37 | - echo ' |
|
36 | + } else { |
|
37 | + echo ' |
|
38 | 38 | <input type="submit" name="accept_agreement" value="', $txt['agreement_agree'], '" class="button">'; |
39 | + } |
|
39 | 40 | |
40 | 41 | echo ' |
41 | 42 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -78,9 +79,10 @@ discard block |
||
78 | 79 | <ul>'; |
79 | 80 | |
80 | 81 | // Cycle through each error and display an error message. |
81 | - foreach ($context['registration_errors'] as $error) |
|
82 | - echo ' |
|
82 | + foreach ($context['registration_errors'] as $error) { |
|
83 | + echo ' |
|
83 | 84 | <li>', $error, '</li>'; |
85 | + } |
|
84 | 86 | |
85 | 87 | echo ' |
86 | 88 | </ul> |
@@ -150,14 +152,15 @@ discard block |
||
150 | 152 | |
151 | 153 | <dl class="register_form">'; |
152 | 154 | |
153 | - foreach ($context['custom_fields'] as $field) |
|
154 | - if ($field['show_reg'] > 1) |
|
155 | + foreach ($context['custom_fields'] as $field) { |
|
156 | + if ($field['show_reg'] > 1) |
|
155 | 157 | echo ' |
156 | 158 | <dt> |
157 | 159 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
158 | 160 | <span class="smalltext">', $field['desc'], '</span> |
159 | 161 | </dt> |
160 | 162 | <dd>', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), '</dd>'; |
163 | + } |
|
161 | 164 | |
162 | 165 | echo ' |
163 | 166 | </dl>'; |
@@ -191,41 +194,45 @@ discard block |
||
191 | 194 | $callback_func = 'template_profile_' . $field['callback_func']; |
192 | 195 | $callback_func(); |
193 | 196 | } |
194 | - } |
|
195 | - else |
|
197 | + } else |
|
196 | 198 | { |
197 | 199 | echo ' |
198 | 200 | <dt> |
199 | 201 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['label'], ':</strong>'; |
200 | 202 | |
201 | 203 | // Does it have any subtext to show? |
202 | - if (!empty($field['subtext'])) |
|
203 | - echo ' |
|
204 | + if (!empty($field['subtext'])) { |
|
205 | + echo ' |
|
204 | 206 | <span class="smalltext">', $field['subtext'], '</span>'; |
207 | + } |
|
205 | 208 | |
206 | 209 | echo ' |
207 | 210 | </dt> |
208 | 211 | <dd>'; |
209 | 212 | |
210 | 213 | // Want to put something infront of the box? |
211 | - if (!empty($field['preinput'])) |
|
212 | - echo ' |
|
214 | + if (!empty($field['preinput'])) { |
|
215 | + echo ' |
|
213 | 216 | ', $field['preinput']; |
217 | + } |
|
214 | 218 | |
215 | 219 | // What type of data are we showing? |
216 | - if ($field['type'] == 'label') |
|
217 | - echo ' |
|
220 | + if ($field['type'] == 'label') { |
|
221 | + echo ' |
|
218 | 222 | ', $field['value']; |
223 | + } |
|
219 | 224 | |
220 | 225 | // Maybe it's a text box - very likely! |
221 | - elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) |
|
222 | - echo ' |
|
226 | + elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) { |
|
227 | + echo ' |
|
223 | 228 | <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
229 | + } |
|
224 | 230 | |
225 | 231 | // You "checking" me out? ;) |
226 | - elseif ($field['type'] == 'check') |
|
227 | - echo ' |
|
232 | + elseif ($field['type'] == 'check') { |
|
233 | + echo ' |
|
228 | 234 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], '>'; |
235 | + } |
|
229 | 236 | |
230 | 237 | // Always fun - select boxes! |
231 | 238 | elseif ($field['type'] == 'select') |
@@ -236,14 +243,16 @@ discard block |
||
236 | 243 | if (isset($field['options'])) |
237 | 244 | { |
238 | 245 | // Is this some code to generate the options? |
239 | - if (!is_array($field['options'])) |
|
240 | - $field['options'] = eval($field['options']); |
|
246 | + if (!is_array($field['options'])) { |
|
247 | + $field['options'] = eval($field['options']); |
|
248 | + } |
|
241 | 249 | |
242 | 250 | // Assuming we now have some! |
243 | - if (is_array($field['options'])) |
|
244 | - foreach ($field['options'] as $value => $name) |
|
251 | + if (is_array($field['options'])) { |
|
252 | + foreach ($field['options'] as $value => $name) |
|
245 | 253 | echo ' |
246 | 254 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
255 | + } |
|
247 | 256 | } |
248 | 257 | |
249 | 258 | echo ' |
@@ -251,9 +260,10 @@ discard block |
||
251 | 260 | } |
252 | 261 | |
253 | 262 | // Something to end with? |
254 | - if (!empty($field['postinput'])) |
|
255 | - echo ' |
|
263 | + if (!empty($field['postinput'])) { |
|
264 | + echo ' |
|
256 | 265 | ', $field['postinput']; |
266 | + } |
|
257 | 267 | |
258 | 268 | echo ' |
259 | 269 | </dd>'; |
@@ -266,13 +276,14 @@ discard block |
||
266 | 276 | { |
267 | 277 | foreach ($context['custom_fields'] as $field) |
268 | 278 | { |
269 | - if ($field['show_reg'] < 2) |
|
270 | - echo ' |
|
279 | + if ($field['show_reg'] < 2) { |
|
280 | + echo ' |
|
271 | 281 | <dt> |
272 | 282 | <strong', !empty($field['is_error']) ? ' class="red"' : '', '>', $field['name'], ':</strong> |
273 | 283 | <span class="smalltext">', $field['desc'], '</span> |
274 | 284 | </dt> |
275 | 285 | <dd>', $field['input_html'], '</dd>'; |
286 | + } |
|
276 | 287 | } |
277 | 288 | } |
278 | 289 | |
@@ -302,14 +313,15 @@ discard block |
||
302 | 313 | <div id="confirm_buttons" class="flow_auto">'; |
303 | 314 | |
304 | 315 | // Age restriction in effect? |
305 | - if (!$context['require_agreement'] && $context['show_coppa']) |
|
306 | - echo ' |
|
316 | + if (!$context['require_agreement'] && $context['show_coppa']) { |
|
317 | + echo ' |
|
307 | 318 | <input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button"><br> |
308 | 319 | <br> |
309 | 320 | <input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button">'; |
310 | - else |
|
311 | - echo ' |
|
321 | + } else { |
|
322 | + echo ' |
|
312 | 323 | <input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button">'; |
324 | + } |
|
313 | 325 | echo ' |
314 | 326 | </div> |
315 | 327 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -457,19 +469,20 @@ discard block |
||
457 | 469 | </head> |
458 | 470 | <body style="margin: 1ex;"> |
459 | 471 | <div class="windowbg description" style="text-align: center;">'; |
460 | - if (isBrowser('is_ie') || isBrowser('is_ie11')) |
|
461 | - echo ' |
|
472 | + if (isBrowser('is_ie') || isBrowser('is_ie11')) { |
|
473 | + echo ' |
|
462 | 474 | <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="audio/x-wav"> |
463 | 475 | <param name="AutoStart" value="1"> |
464 | 476 | <param name="FileName" value="', $context['verification_sound_href'], '"> |
465 | 477 | </object>'; |
466 | - else |
|
467 | - echo ' |
|
478 | + } else { |
|
479 | + echo ' |
|
468 | 480 | <audio src="', $context['verification_sound_href'], '" controls> |
469 | 481 | <object type="audio/x-wav" data="', $context['verification_sound_href'], '"> |
470 | 482 | <a href="', $context['verification_sound_href'], '" rel="nofollow">', $context['verification_sound_href'], '</a> |
471 | 483 | </object> |
472 | 484 | </audio>'; |
485 | + } |
|
473 | 486 | echo ' |
474 | 487 | <br> |
475 | 488 | <a href="', $context['verification_sound_href'], ';sound" rel="nofollow">', $txt['visual_verification_sound_again'], '</a><br> |
@@ -496,11 +509,12 @@ discard block |
||
496 | 509 | </div> |
497 | 510 | <div id="register_screen" class="windowbg2 noup">'; |
498 | 511 | |
499 | - if (!empty($context['registration_done'])) |
|
500 | - echo ' |
|
512 | + if (!empty($context['registration_done'])) { |
|
513 | + echo ' |
|
501 | 514 | <div class="infobox"> |
502 | 515 | ', $context['registration_done'], ' |
503 | 516 | </div>'; |
517 | + } |
|
504 | 518 | |
505 | 519 | echo ' |
506 | 520 | <dl class="register_form" id="admin_register_form"> |
@@ -536,9 +550,10 @@ discard block |
||
536 | 550 | <dd> |
537 | 551 | <select name="group" id="group_select" tabindex="', $context['tabindex']++, '">'; |
538 | 552 | |
539 | - foreach ($context['member_groups'] as $id => $name) |
|
540 | - echo ' |
|
553 | + foreach ($context['member_groups'] as $id => $name) { |
|
554 | + echo ' |
|
541 | 555 | <option value="', $id, '">', $name, '</option>'; |
556 | + } |
|
542 | 557 | |
543 | 558 | echo ' |
544 | 559 | </select> |
@@ -546,8 +561,8 @@ discard block |
||
546 | 561 | } |
547 | 562 | |
548 | 563 | // If there is any field marked as required, show it here! |
549 | - if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) |
|
550 | - foreach ($context['custom_fields'] as $field) |
|
564 | + if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) { |
|
565 | + foreach ($context['custom_fields'] as $field) |
|
551 | 566 | if ($field['show_reg'] > 1) |
552 | 567 | echo ' |
553 | 568 | <dt> |
@@ -557,6 +572,7 @@ discard block |
||
557 | 572 | <dd> |
558 | 573 | ', str_replace('name="', 'tabindex="' . $context['tabindex']++ . '" name="', $field['input_html']), ' |
559 | 574 | </dd>'; |
575 | + } |
|
560 | 576 | |
561 | 577 | echo ' |
562 | 578 | <dt> |
@@ -593,12 +609,13 @@ discard block |
||
593 | 609 | { |
594 | 610 | global $context, $scripturl, $txt; |
595 | 611 | |
596 | - if (!empty($context['saved_successful'])) |
|
597 | - echo ' |
|
612 | + if (!empty($context['saved_successful'])) { |
|
613 | + echo ' |
|
598 | 614 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
599 | - elseif (!empty($context['could_not_save'])) |
|
600 | - echo ' |
|
615 | + } elseif (!empty($context['could_not_save'])) { |
|
616 | + echo ' |
|
601 | 617 | <div class="errorbox">', $txt['admin_agreement_not_saved'], '</div>'; |
618 | + } |
|
602 | 619 | |
603 | 620 | // Just a big box to edit the text file ;) |
604 | 621 | echo ' |
@@ -608,9 +625,10 @@ discard block |
||
608 | 625 | </div>'; |
609 | 626 | |
610 | 627 | // Warning for if the file isn't writable. |
611 | - if (!empty($context['warning'])) |
|
612 | - echo ' |
|
628 | + if (!empty($context['warning'])) { |
|
629 | + echo ' |
|
613 | 630 | <p class="error">', $context['warning'], '</p>'; |
631 | + } |
|
614 | 632 | |
615 | 633 | echo ' |
616 | 634 | <div class="windowbg2 noup" id="registration_agreement">'; |
@@ -627,9 +645,10 @@ discard block |
||
627 | 645 | <strong>', $txt['admin_agreement_select_language'], ':</strong> |
628 | 646 | <select name="agree_lang" onchange="document.getElementById(\'change_reg\').submit();" tabindex="', $context['tabindex']++, '">'; |
629 | 647 | |
630 | - foreach ($context['editable_agreements'] as $file => $name) |
|
631 | - echo ' |
|
648 | + foreach ($context['editable_agreements'] as $file => $name) { |
|
649 | + echo ' |
|
632 | 650 | <option value="', $file, '"', $context['current_agreement'] == $file ? ' selected' : '', '>', $name, '</option>'; |
651 | + } |
|
633 | 652 | |
634 | 653 | echo ' |
635 | 654 | </select> |
@@ -669,9 +688,10 @@ discard block |
||
669 | 688 | { |
670 | 689 | global $context, $scripturl, $txt; |
671 | 690 | |
672 | - if (!empty($context['saved_successful'])) |
|
673 | - echo ' |
|
691 | + if (!empty($context['saved_successful'])) { |
|
692 | + echo ' |
|
674 | 693 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
694 | + } |
|
675 | 695 | |
676 | 696 | echo ' |
677 | 697 | <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=regcenter" method="post" accept-charset="', $context['character_set'], '"> |
@@ -144,11 +144,12 @@ discard block |
||
144 | 144 | <div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>'; |
145 | 145 | |
146 | 146 | $options = 1; |
147 | - foreach ($context['poll']['options'] as $option) |
|
148 | - echo ' |
|
147 | + foreach ($context['poll']['options'] as $option) { |
|
148 | + echo ' |
|
149 | 149 | <div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $options++, ': <strong>', $option['option'], '</strong> |
150 | 150 | ', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] . '' : '', ' |
151 | 151 | </div>'; |
152 | + } |
|
152 | 153 | |
153 | 154 | echo ' |
154 | 155 | </div>'; |
@@ -170,9 +171,10 @@ discard block |
||
170 | 171 | echo ' |
171 | 172 | <hr>'; |
172 | 173 | |
173 | - foreach ($context['printattach'][$post['id_msg']] as $attach) |
|
174 | - echo ' |
|
174 | + foreach ($context['printattach'][$post['id_msg']] as $attach) { |
|
175 | + echo ' |
|
175 | 176 | <img width="' . $attach['width'] . '" height="' . $attach['height'] . '" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="">'; |
177 | + } |
|
176 | 178 | } |
177 | 179 | |
178 | 180 | echo ' |
@@ -207,12 +209,13 @@ discard block |
||
207 | 209 | <div class="print_options">'; |
208 | 210 | |
209 | 211 | // Which option is set, text or text&images |
210 | - if (isset($_REQUEST['images'])) |
|
211 | - echo ' |
|
212 | + if (isset($_REQUEST['images'])) { |
|
213 | + echo ' |
|
212 | 214 | <a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>'; |
213 | - else |
|
214 | - echo ' |
|
215 | + } else { |
|
216 | + echo ' |
|
215 | 217 | <strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>'; |
218 | + } |
|
216 | 219 | |
217 | 220 | echo ' |
218 | 221 | </div><!-- .print_options -->'; |
@@ -25,15 +25,17 @@ discard block |
||
25 | 25 | </h3> |
26 | 26 | </div>'; |
27 | 27 | |
28 | - if (!empty($context['search_errors'])) |
|
29 | - echo ' |
|
28 | + if (!empty($context['search_errors'])) { |
|
29 | + echo ' |
|
30 | 30 | <div class="errorbox">', implode('<br>', $context['search_errors']['messages']), '</div>'; |
31 | + } |
|
31 | 32 | |
32 | - if (!empty($context['search_ignored'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['search_ignored'])) { |
|
34 | + echo ' |
|
34 | 35 | <p class="noticebox"> |
35 | 36 | ', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), ' |
36 | 37 | </p>'; |
38 | + } |
|
37 | 39 | |
38 | 40 | echo ' |
39 | 41 | <div id="advanced_search" class="roundframe"> |
@@ -44,9 +46,10 @@ discard block |
||
44 | 46 | <dd> |
45 | 47 | <input type="search" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40">'; |
46 | 48 | |
47 | - if (empty($modSettings['search_simple_fulltext'])) |
|
48 | - echo ' |
|
49 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
50 | + echo ' |
|
49 | 51 | <br><em class="smalltext">', $txt['search_example'], '</em>'; |
52 | + } |
|
50 | 53 | |
51 | 54 | echo ' |
52 | 55 | </dd> |
@@ -120,13 +123,14 @@ discard block |
||
120 | 123 | } |
121 | 124 | |
122 | 125 | // If $context['search_params']['topic'] is set, that means we're searching just one topic. |
123 | - if (!empty($context['search_params']['topic'])) |
|
124 | - echo ' |
|
126 | + if (!empty($context['search_params']['topic'])) { |
|
127 | + echo ' |
|
125 | 128 | <p> |
126 | 129 | ', $txt['search_specific_topic'], ' "', $context['search_topic']['link'], '". |
127 | 130 | </p> |
128 | 131 | <input type="hidden" name="topic" value="', $context['search_topic']['id'], '"> |
129 | 132 | <input type="submit" name="b_search" value="', $txt['search'], '" class="button">'; |
133 | + } |
|
130 | 134 | |
131 | 135 | echo ' |
132 | 136 | </div>'; |
@@ -156,14 +160,15 @@ discard block |
||
156 | 160 | |
157 | 161 | foreach ($category['boards'] as $board) |
158 | 162 | { |
159 | - if ($i == $limit) |
|
160 | - echo ' |
|
163 | + if ($i == $limit) { |
|
164 | + echo ' |
|
161 | 165 | </ul> |
162 | 166 | </li> |
163 | 167 | </ul> |
164 | 168 | <ul class="ignoreboards floatright"> |
165 | 169 | <li class="category"> |
166 | 170 | <ul>'; |
171 | + } |
|
167 | 172 | |
168 | 173 | echo ' |
169 | 174 | <li class="board"> |
@@ -251,17 +256,19 @@ discard block |
||
251 | 256 | <div class="roundframe">'; |
252 | 257 | |
253 | 258 | // Did they make any typos or mistakes, perhaps? |
254 | - if (isset($context['did_you_mean'])) |
|
255 | - echo ' |
|
259 | + if (isset($context['did_you_mean'])) { |
|
260 | + echo ' |
|
256 | 261 | <p> |
257 | 262 | ', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search2;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>. |
258 | 263 | </p>'; |
264 | + } |
|
259 | 265 | |
260 | - if (!empty($context['search_ignored'])) |
|
261 | - echo ' |
|
266 | + if (!empty($context['search_ignored'])) { |
|
267 | + echo ' |
|
262 | 268 | <p> |
263 | 269 | ', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), ' |
264 | 270 | </p>'; |
271 | + } |
|
265 | 272 | |
266 | 273 | echo ' |
267 | 274 | <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"> |
@@ -284,10 +291,11 @@ discard block |
||
284 | 291 | <input type="hidden" name="sort" value="', !empty($context['search_params']['sort']) ? $context['search_params']['sort'] : 'relevance', '"> |
285 | 292 | </div>'; |
286 | 293 | |
287 | - if (!empty($context['search_params']['brd'])) |
|
288 | - foreach ($context['search_params']['brd'] as $board_id) |
|
294 | + if (!empty($context['search_params']['brd'])) { |
|
295 | + foreach ($context['search_params']['brd'] as $board_id) |
|
289 | 296 | echo ' |
290 | 297 | <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '">'; |
298 | + } |
|
291 | 299 | |
292 | 300 | echo ' |
293 | 301 | </form> |
@@ -299,18 +307,20 @@ discard block |
||
299 | 307 | if ($context['compact']) |
300 | 308 | { |
301 | 309 | // Quick moderation set to checkboxes? Oh, how fun :/ |
302 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
303 | - echo ' |
|
310 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
311 | + echo ' |
|
304 | 312 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="topicForm">'; |
313 | + } |
|
305 | 314 | |
306 | 315 | echo ' |
307 | 316 | <div class="cat_bar"> |
308 | 317 | <h3 class="catbg"> |
309 | 318 | <span class="floatright">'; |
310 | 319 | |
311 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
|
312 | - echo ' |
|
320 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { |
|
321 | + echo ' |
|
313 | 322 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">'; |
323 | + } |
|
314 | 324 | echo ' |
315 | 325 | </span> |
316 | 326 | <span class="generic_icons filter"></span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' |
@@ -318,15 +328,15 @@ discard block |
||
318 | 328 | </div>'; |
319 | 329 | |
320 | 330 | // Was anything even found? |
321 | - if (!empty($context['topics'])) |
|
322 | - echo ' |
|
331 | + if (!empty($context['topics'])) { |
|
332 | + echo ' |
|
323 | 333 | <div class="pagesection"> |
324 | 334 | <span>', $context['page_index'], '</span> |
325 | 335 | </div>'; |
326 | - |
|
327 | - else |
|
328 | - echo ' |
|
336 | + } else { |
|
337 | + echo ' |
|
329 | 338 | <div class="roundframe">', $txt['find_no_results'], '</div>'; |
339 | + } |
|
330 | 340 | |
331 | 341 | // While we have results to show ... |
332 | 342 | while ($topic = $context['get_topics']()) |
@@ -354,38 +364,43 @@ discard block |
||
354 | 364 | { |
355 | 365 | echo ' |
356 | 366 | <input type="checkbox" name="topics[]" value="', $topic['id'], '">'; |
357 | - } |
|
358 | - else |
|
367 | + } else |
|
359 | 368 | { |
360 | - if ($topic['quick_mod']['remove']) |
|
361 | - echo ' |
|
369 | + if ($topic['quick_mod']['remove']) { |
|
370 | + echo ' |
|
362 | 371 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons delete" title="', $txt['remove_topic'], '"></span></a>'; |
372 | + } |
|
363 | 373 | |
364 | - if ($topic['quick_mod']['lock']) |
|
365 | - echo ' |
|
374 | + if ($topic['quick_mod']['lock']) { |
|
375 | + echo ' |
|
366 | 376 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>'; |
377 | + } |
|
367 | 378 | |
368 | - if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) |
|
369 | - echo ' |
|
379 | + if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { |
|
380 | + echo ' |
|
370 | 381 | <br>'; |
382 | + } |
|
371 | 383 | |
372 | - if ($topic['quick_mod']['sticky']) |
|
373 | - echo ' |
|
384 | + if ($topic['quick_mod']['sticky']) { |
|
385 | + echo ' |
|
374 | 386 | <a href="', $scripturl, '?action=quickmod;board=' . $topic['board']['id'] . '.0;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>'; |
387 | + } |
|
375 | 388 | |
376 | - if ($topic['quick_mod']['move']) |
|
377 | - echo ' |
|
389 | + if ($topic['quick_mod']['move']) { |
|
390 | + echo ' |
|
378 | 391 | <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><span class="generic_icons move" title="', $txt['move_topic'], '"></span></a>'; |
392 | + } |
|
379 | 393 | } |
380 | 394 | |
381 | 395 | echo ' |
382 | 396 | </div><!-- .floatright -->'; |
383 | 397 | } |
384 | 398 | |
385 | - if ($message['body_highlighted'] != '') |
|
386 | - echo ' |
|
399 | + if ($message['body_highlighted'] != '') { |
|
400 | + echo ' |
|
387 | 401 | <br class="clear"> |
388 | 402 | <div class="list_posts double_height">', $message['body_highlighted'], '</div>'; |
403 | + } |
|
389 | 404 | } |
390 | 405 | |
391 | 406 | echo ' |
@@ -393,11 +408,12 @@ discard block |
||
393 | 408 | </div><!-- $topic[css_class] -->'; |
394 | 409 | |
395 | 410 | } |
396 | - if (!empty($context['topics'])) |
|
397 | - echo ' |
|
411 | + if (!empty($context['topics'])) { |
|
412 | + echo ' |
|
398 | 413 | <div class="pagesection"> |
399 | 414 | <span>', $context['page_index'], '</span> |
400 | 415 | </div>'; |
416 | + } |
|
401 | 417 | |
402 | 418 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
403 | 419 | { |
@@ -407,17 +423,19 @@ discard block |
||
407 | 423 | <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> |
408 | 424 | <option value="">--------</option>'; |
409 | 425 | |
410 | - foreach ($context['qmod_actions'] as $qmod_action) |
|
411 | - if ($context['can_' . $qmod_action]) |
|
426 | + foreach ($context['qmod_actions'] as $qmod_action) { |
|
427 | + if ($context['can_' . $qmod_action]) |
|
412 | 428 | echo ' |
413 | 429 | <option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>'; |
430 | + } |
|
414 | 431 | |
415 | 432 | echo ' |
416 | 433 | </select>'; |
417 | 434 | |
418 | - if ($context['can_move']) |
|
419 | - echo ' |
|
435 | + if ($context['can_move']) { |
|
436 | + echo ' |
|
420 | 437 | <span id="quick_mod_jump_to"> </span>'; |
438 | + } |
|
421 | 439 | |
422 | 440 | echo ' |
423 | 441 | <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search2;params=' . $context['params'], '"> |
@@ -427,13 +445,13 @@ discard block |
||
427 | 445 | } |
428 | 446 | |
429 | 447 | |
430 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) |
|
431 | - echo ' |
|
448 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { |
|
449 | + echo ' |
|
432 | 450 | <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '"> |
433 | 451 | </form>'; |
452 | + } |
|
434 | 453 | |
435 | - } |
|
436 | - else |
|
454 | + } else |
|
437 | 455 | { |
438 | 456 | echo ' |
439 | 457 | <div class="cat_bar"> |
@@ -445,9 +463,10 @@ discard block |
||
445 | 463 | <span>', $context['page_index'], '</span> |
446 | 464 | </div>'; |
447 | 465 | |
448 | - if (empty($context['topics'])) |
|
449 | - echo ' |
|
466 | + if (empty($context['topics'])) { |
|
467 | + echo ' |
|
450 | 468 | <div class="information">(', $txt['search_no_results'], ')</div>'; |
469 | + } |
|
451 | 470 | |
452 | 471 | while ($topic = $context['get_topics']()) |
453 | 472 | { |
@@ -464,23 +483,27 @@ discard block |
||
464 | 483 | </div> |
465 | 484 | <div class="list_posts">', $message['body_highlighted'], '</div>'; |
466 | 485 | |
467 | - if ($topic['can_reply']) |
|
468 | - echo ' |
|
486 | + if ($topic['can_reply']) { |
|
487 | + echo ' |
|
469 | 488 | <ul class="quickbuttons">'; |
489 | + } |
|
470 | 490 | |
471 | 491 | // If they *can* reply? |
472 | - if ($topic['can_reply']) |
|
473 | - echo ' |
|
492 | + if ($topic['can_reply']) { |
|
493 | + echo ' |
|
474 | 494 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
495 | + } |
|
475 | 496 | |
476 | 497 | // If they *can* quote? |
477 | - if ($topic['can_quote']) |
|
478 | - echo ' |
|
498 | + if ($topic['can_quote']) { |
|
499 | + echo ' |
|
479 | 500 | <li><a href="', $scripturl . '?action=post;topic=' . $topic['id'] . '.' . $message['start'] . ';quote=' . $message['id'] . '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
501 | + } |
|
480 | 502 | |
481 | - if ($topic['can_reply']) |
|
482 | - echo ' |
|
503 | + if ($topic['can_reply']) { |
|
504 | + echo ' |
|
483 | 505 | </ul>'; |
506 | + } |
|
484 | 507 | echo ' |
485 | 508 | <br class="clear"> |
486 | 509 | </div><!-- $topic[css_class] -->'; |
@@ -499,8 +522,8 @@ discard block |
||
499 | 522 | <div class="smalltext righttext" id="search_jump_to"> </div> |
500 | 523 | <script>'; |
501 | 524 | |
502 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) |
|
503 | - echo ' |
|
525 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { |
|
526 | + echo ' |
|
504 | 527 | if (typeof(window.XMLHttpRequest) != "undefined") |
505 | 528 | aJumpTo[aJumpTo.length] = new JumpTo({ |
506 | 529 | sContainerId: "quick_mod_jump_to", |
@@ -515,6 +538,7 @@ discard block |
||
515 | 538 | bDisabled: true, |
516 | 539 | sCustomName: "move_to" |
517 | 540 | });'; |
541 | + } |
|
518 | 542 | |
519 | 543 | echo ' |
520 | 544 | if (typeof(window.XMLHttpRequest) != "undefined") |