@@ -891,13 +891,13 @@ |
||
891 | 891 | if ($start_char === 'C') |
892 | 892 | $limit_seek = $limit; |
893 | 893 | else |
894 | - $limit_seek = $limit + 1; |
|
894 | + $limit_seek = $limit + 1; |
|
895 | 895 | |
896 | 896 | $request = $smcFunc['db_query']('', ' |
897 | 897 | SELECT id_msg, id_member, approved |
898 | 898 | FROM {db_prefix}messages |
899 | 899 | WHERE id_topic = {int:current_topic} |
900 | - AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
900 | + AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
901 | 901 | AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . ' |
902 | 902 | ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : ' |
903 | 903 | LIMIT {int:limit}'), |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * The central part of the board - topic display. |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | global $messages_request, $language, $smcFunc; |
35 | 36 | |
36 | 37 | // What are you gonna display if these are empty?! |
37 | - if (empty($topic)) |
|
38 | - fatal_lang_error('no_board', false); |
|
38 | + if (empty($topic)) { |
|
39 | + fatal_lang_error('no_board', false); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // Load the proper template. |
41 | 43 | loadTemplate('Display'); |
@@ -52,15 +54,17 @@ discard block |
||
52 | 54 | $context['messages_per_page'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages']; |
53 | 55 | |
54 | 56 | // Let's do some work on what to search index. |
55 | - if (count($_GET) > 2) |
|
56 | - foreach ($_GET as $k => $v) |
|
57 | + if (count($_GET) > 2) { |
|
58 | + foreach ($_GET as $k => $v) |
|
57 | 59 | { |
58 | 60 | if (!in_array($k, array('topic', 'board', 'start', session_name()))) |
59 | 61 | $context['robot_no_index'] = true; |
62 | + } |
|
60 | 63 | } |
61 | 64 | |
62 | - if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) |
|
63 | - $context['robot_no_index'] = true; |
|
65 | + if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) { |
|
66 | + $context['robot_no_index'] = true; |
|
67 | + } |
|
64 | 68 | |
65 | 69 | // Find the previous or next topic. Make a fuss if there are no more. |
66 | 70 | if (isset($_REQUEST['prev_next']) && ($_REQUEST['prev_next'] == 'prev' || $_REQUEST['prev_next'] == 'next')) |
@@ -172,8 +176,9 @@ discard block |
||
172 | 176 | $topic_parameters |
173 | 177 | ); |
174 | 178 | |
175 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
176 | - fatal_lang_error('not_a_topic', false, 404); |
|
179 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
180 | + fatal_lang_error('not_a_topic', false, 404); |
|
181 | + } |
|
177 | 182 | $context['topicinfo'] = $smcFunc['db_fetch_assoc']($request); |
178 | 183 | $smcFunc['db_free_result']($request); |
179 | 184 | |
@@ -210,8 +215,9 @@ discard block |
||
210 | 215 | $context['topic_unwatched'] = isset($context['topicinfo']['unwatched']) ? $context['topicinfo']['unwatched'] : 0; |
211 | 216 | |
212 | 217 | // Add up unapproved replies to get real number of replies... |
213 | - if ($modSettings['postmod_active'] && $approve_posts) |
|
214 | - $context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1); |
|
218 | + if ($modSettings['postmod_active'] && $approve_posts) { |
|
219 | + $context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1); |
|
220 | + } |
|
215 | 221 | |
216 | 222 | // If this topic has unapproved posts, we need to work out how many posts the user can see, for page indexing. |
217 | 223 | if ($modSettings['postmod_active'] && $context['topicinfo']['unapproved_posts'] && !$user_info['is_guest'] && !$approve_posts) |
@@ -231,11 +237,11 @@ discard block |
||
231 | 237 | $smcFunc['db_free_result']($request); |
232 | 238 | |
233 | 239 | $context['total_visible_posts'] = $context['num_replies'] + $myUnapprovedPosts + ($context['topicinfo']['approved'] ? 1 : 0); |
240 | + } elseif ($user_info['is_guest']) { |
|
241 | + $context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
242 | + } else { |
|
243 | + $context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
234 | 244 | } |
235 | - elseif ($user_info['is_guest']) |
|
236 | - $context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
237 | - else |
|
238 | - $context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
239 | 245 | |
240 | 246 | // The start isn't a number; it's information about what to do, where to go. |
241 | 247 | if (!is_numeric($_REQUEST['start'])) |
@@ -248,8 +254,7 @@ discard block |
||
248 | 254 | { |
249 | 255 | $context['start_from'] = $context['total_visible_posts'] - 1; |
250 | 256 | $_REQUEST['start'] = empty($options['view_newest_first']) ? $context['start_from'] : 0; |
251 | - } |
|
252 | - else |
|
257 | + } else |
|
253 | 258 | { |
254 | 259 | // Find the earliest unread message in the topic. (the use of topics here is just for both tables.) |
255 | 260 | $request = $smcFunc['db_query']('', ' |
@@ -277,9 +282,9 @@ discard block |
||
277 | 282 | if (substr($_REQUEST['start'], 0, 4) == 'from') |
278 | 283 | { |
279 | 284 | $timestamp = (int) substr($_REQUEST['start'], 4); |
280 | - if ($timestamp === 0) |
|
281 | - $_REQUEST['start'] = 0; |
|
282 | - else |
|
285 | + if ($timestamp === 0) { |
|
286 | + $_REQUEST['start'] = 0; |
|
287 | + } else |
|
283 | 288 | { |
284 | 289 | // Find the number of messages posted before said time... |
285 | 290 | $request = $smcFunc['db_query']('', ' |
@@ -307,11 +312,11 @@ discard block |
||
307 | 312 | elseif (substr($_REQUEST['start'], 0, 3) == 'msg') |
308 | 313 | { |
309 | 314 | $virtual_msg = (int) substr($_REQUEST['start'], 3); |
310 | - if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg']) |
|
311 | - $context['start_from'] = $context['total_visible_posts'] - 1; |
|
312 | - elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg']) |
|
313 | - $context['start_from'] = 0; |
|
314 | - else |
|
315 | + if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg']) { |
|
316 | + $context['start_from'] = $context['total_visible_posts'] - 1; |
|
317 | + } elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg']) { |
|
318 | + $context['start_from'] = 0; |
|
319 | + } else |
|
315 | 320 | { |
316 | 321 | // Find the start value for that message...... |
317 | 322 | $request = $smcFunc['db_query']('', ' |
@@ -394,21 +399,25 @@ discard block |
||
394 | 399 | ); |
395 | 400 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
396 | 401 | { |
397 | - if (empty($row['id_member'])) |
|
398 | - continue; |
|
402 | + if (empty($row['id_member'])) { |
|
403 | + continue; |
|
404 | + } |
|
399 | 405 | |
400 | - if (!empty($row['online_color'])) |
|
401 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
402 | - else |
|
403 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
406 | + if (!empty($row['online_color'])) { |
|
407 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
408 | + } else { |
|
409 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
410 | + } |
|
404 | 411 | |
405 | 412 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
406 | - if ($is_buddy) |
|
407 | - $link = '<strong>' . $link . '</strong>'; |
|
413 | + if ($is_buddy) { |
|
414 | + $link = '<strong>' . $link . '</strong>'; |
|
415 | + } |
|
408 | 416 | |
409 | 417 | // Add them both to the list and to the more detailed list. |
410 | - if (!empty($row['show_online']) || allowedTo('moderate_forum')) |
|
411 | - $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
418 | + if (!empty($row['show_online']) || allowedTo('moderate_forum')) { |
|
419 | + $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
420 | + } |
|
412 | 421 | $context['view_members'][$row['log_time'] . $row['member_name']] = array( |
413 | 422 | 'id' => $row['id_member'], |
414 | 423 | 'username' => $row['member_name'], |
@@ -420,8 +429,9 @@ discard block |
||
420 | 429 | 'hidden' => empty($row['show_online']), |
421 | 430 | ); |
422 | 431 | |
423 | - if (empty($row['show_online'])) |
|
424 | - $context['view_num_hidden']++; |
|
432 | + if (empty($row['show_online'])) { |
|
433 | + $context['view_num_hidden']++; |
|
434 | + } |
|
425 | 435 | } |
426 | 436 | |
427 | 437 | // The number of guests is equal to the rows minus the ones we actually used ;). |
@@ -435,11 +445,13 @@ discard block |
||
435 | 445 | |
436 | 446 | // If all is set, but not allowed... just unset it. |
437 | 447 | $can_show_all = !empty($modSettings['enableAllMessages']) && $context['total_visible_posts'] > $context['messages_per_page'] && $context['total_visible_posts'] < $modSettings['enableAllMessages']; |
438 | - if (isset($_REQUEST['all']) && !$can_show_all) |
|
439 | - unset($_REQUEST['all']); |
|
448 | + if (isset($_REQUEST['all']) && !$can_show_all) { |
|
449 | + unset($_REQUEST['all']); |
|
450 | + } |
|
440 | 451 | // Otherwise, it must be allowed... so pretend start was -1. |
441 | - elseif (isset($_REQUEST['all'])) |
|
442 | - $_REQUEST['start'] = -1; |
|
452 | + elseif (isset($_REQUEST['all'])) { |
|
453 | + $_REQUEST['start'] = -1; |
|
454 | + } |
|
443 | 455 | |
444 | 456 | // Construct the page index, allowing for the .START method... |
445 | 457 | $context['page_index'] = constructPageIndex($scripturl . '?topic=' . $topic . '.%1$d', $_REQUEST['start'], $context['total_visible_posts'], $context['messages_per_page'], true); |
@@ -476,8 +488,9 @@ discard block |
||
476 | 488 | $_REQUEST['start'] = 0; |
477 | 489 | } |
478 | 490 | // They aren't using it, but the *option* is there, at least. |
479 | - else |
|
480 | - $context['page_index'] .= ' <a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> '; |
|
491 | + else { |
|
492 | + $context['page_index'] .= ' <a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> '; |
|
493 | + } |
|
481 | 494 | } |
482 | 495 | |
483 | 496 | // Build the link tree. |
@@ -493,14 +506,16 @@ discard block |
||
493 | 506 | if (!empty($board_info['moderators'])) |
494 | 507 | { |
495 | 508 | // Add a link for each moderator... |
496 | - foreach ($board_info['moderators'] as $mod) |
|
497 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
509 | + foreach ($board_info['moderators'] as $mod) { |
|
510 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
511 | + } |
|
498 | 512 | } |
499 | 513 | if (!empty($board_info['moderator_groups'])) |
500 | 514 | { |
501 | 515 | // Add a link for each moderator group as well... |
502 | - foreach ($board_info['moderator_groups'] as $mod_group) |
|
503 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
516 | + foreach ($board_info['moderator_groups'] as $mod_group) { |
|
517 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
518 | + } |
|
504 | 519 | } |
505 | 520 | |
506 | 521 | if (!empty($context['link_moderators'])) |
@@ -531,9 +546,9 @@ discard block |
||
531 | 546 | // For quick reply we need a response prefix in the default forum language. |
532 | 547 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix', 600))) |
533 | 548 | { |
534 | - if ($language === $user_info['language']) |
|
535 | - $context['response_prefix'] = $txt['response_prefix']; |
|
536 | - else |
|
549 | + if ($language === $user_info['language']) { |
|
550 | + $context['response_prefix'] = $txt['response_prefix']; |
|
551 | + } else |
|
537 | 552 | { |
538 | 553 | loadLanguage('index', $language, false); |
539 | 554 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -565,8 +580,9 @@ discard block |
||
565 | 580 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
566 | 581 | |
567 | 582 | // Sanity check |
568 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
569 | - continue; |
|
583 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
584 | + continue; |
|
585 | + } |
|
570 | 586 | |
571 | 587 | $linked_calendar_event = array( |
572 | 588 | 'id' => $row['id_event'], |
@@ -615,8 +631,9 @@ discard block |
||
615 | 631 | } |
616 | 632 | $smcFunc['db_free_result']($request); |
617 | 633 | |
618 | - if (!empty($context['linked_calendar_events'])) |
|
619 | - $context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true; |
|
634 | + if (!empty($context['linked_calendar_events'])) { |
|
635 | + $context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true; |
|
636 | + } |
|
620 | 637 | } |
621 | 638 | |
622 | 639 | // Create the poll info if it exists. |
@@ -679,8 +696,9 @@ discard block |
||
679 | 696 | $smcFunc['db_free_result']($request); |
680 | 697 | |
681 | 698 | // Got we multi choice? |
682 | - if ($pollinfo['max_votes'] > 1) |
|
683 | - $realtotal = $pollinfo['total']; |
|
699 | + if ($pollinfo['max_votes'] > 1) { |
|
700 | + $realtotal = $pollinfo['total']; |
|
701 | + } |
|
684 | 702 | |
685 | 703 | // If this is a guest we need to do our best to work out if they have voted, and what they voted for. |
686 | 704 | if ($user_info['is_guest'] && $pollinfo['guest_vote'] && allowedTo('poll_vote')) |
@@ -693,20 +711,21 @@ discard block |
||
693 | 711 | foreach ($guestinfo as $i => $guestvoted) |
694 | 712 | { |
695 | 713 | $guestvoted = explode(',', $guestvoted); |
696 | - if ($guestvoted[0] == $context['topicinfo']['id_poll']) |
|
697 | - break; |
|
714 | + if ($guestvoted[0] == $context['topicinfo']['id_poll']) { |
|
715 | + break; |
|
716 | + } |
|
698 | 717 | } |
699 | 718 | // Has the poll been reset since guest voted? |
700 | 719 | if ($pollinfo['reset_poll'] > $guestvoted[1]) |
701 | 720 | { |
702 | 721 | // Remove the poll info from the cookie to allow guest to vote again |
703 | 722 | unset($guestinfo[$i]); |
704 | - if (!empty($guestinfo)) |
|
705 | - $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
706 | - else |
|
707 | - unset($_COOKIE['guest_poll_vote']); |
|
708 | - } |
|
709 | - else |
|
723 | + if (!empty($guestinfo)) { |
|
724 | + $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
725 | + } else { |
|
726 | + unset($_COOKIE['guest_poll_vote']); |
|
727 | + } |
|
728 | + } else |
|
710 | 729 | { |
711 | 730 | // What did they vote for? |
712 | 731 | unset($guestvoted[0], $guestvoted[1]); |
@@ -820,23 +839,29 @@ discard block |
||
820 | 839 | // Build the poll moderation button array. |
821 | 840 | $context['poll_buttons'] = array(); |
822 | 841 | |
823 | - if ($context['allow_return_vote']) |
|
824 | - $context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']); |
|
842 | + if ($context['allow_return_vote']) { |
|
843 | + $context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']); |
|
844 | + } |
|
825 | 845 | |
826 | - if ($context['show_view_results_button']) |
|
827 | - $context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'); |
|
846 | + if ($context['show_view_results_button']) { |
|
847 | + $context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'); |
|
848 | + } |
|
828 | 849 | |
829 | - if ($context['allow_change_vote']) |
|
830 | - $context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
850 | + if ($context['allow_change_vote']) { |
|
851 | + $context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
852 | + } |
|
831 | 853 | |
832 | - if ($context['allow_lock_poll']) |
|
833 | - $context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
854 | + if ($context['allow_lock_poll']) { |
|
855 | + $context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
856 | + } |
|
834 | 857 | |
835 | - if ($context['allow_edit_poll']) |
|
836 | - $context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
858 | + if ($context['allow_edit_poll']) { |
|
859 | + $context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
860 | + } |
|
837 | 861 | |
838 | - if ($context['can_remove_poll']) |
|
839 | - $context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
862 | + if ($context['can_remove_poll']) { |
|
863 | + $context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
864 | + } |
|
840 | 865 | |
841 | 866 | // Allow mods to add additional buttons here |
842 | 867 | call_integration_hook('integrate_poll_buttons'); |
@@ -871,9 +896,9 @@ discard block |
||
871 | 896 | { |
872 | 897 | $start_char = 'C'; |
873 | 898 | $page_id = $context['topicinfo']['id_first_msg']; |
899 | + } else { |
|
900 | + $start_char = null; |
|
874 | 901 | } |
875 | - else |
|
876 | - $start_char = null; |
|
877 | 902 | |
878 | 903 | $limit = $context['messages_per_page']; |
879 | 904 | |
@@ -888,17 +913,17 @@ discard block |
||
888 | 913 | { |
889 | 914 | $ascending = true; |
890 | 915 | $page_operator = '>='; |
891 | - } |
|
892 | - else |
|
916 | + } else |
|
893 | 917 | { |
894 | 918 | $ascending = false; |
895 | 919 | $page_operator = '<='; |
896 | 920 | } |
897 | 921 | |
898 | - if ($start_char === 'C') |
|
899 | - $limit_seek = $limit; |
|
900 | - else |
|
901 | - $limit_seek = $limit + 1; |
|
922 | + if ($start_char === 'C') { |
|
923 | + $limit_seek = $limit; |
|
924 | + } else { |
|
925 | + $limit_seek = $limit + 1; |
|
926 | + } |
|
902 | 927 | |
903 | 928 | $request = $smcFunc['db_query']('', ' |
904 | 929 | SELECT id_msg, id_member, approved |
@@ -921,21 +946,23 @@ discard block |
||
921 | 946 | $found_msg = false; |
922 | 947 | |
923 | 948 | // Fallback |
924 | - if ($smcFunc['db_num_rows']($request) < 1) |
|
925 | - unset($start_char); |
|
926 | - else |
|
949 | + if ($smcFunc['db_num_rows']($request) < 1) { |
|
950 | + unset($start_char); |
|
951 | + } else |
|
927 | 952 | { |
928 | 953 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
929 | 954 | { |
930 | 955 | // Check if the start msg is in our result |
931 | - if ($row['id_msg'] == $page_id) |
|
932 | - $found_msg = true; |
|
956 | + if ($row['id_msg'] == $page_id) { |
|
957 | + $found_msg = true; |
|
958 | + } |
|
933 | 959 | |
934 | 960 | // Skip the the start msg if we not in mode C |
935 | 961 | if ($start_char === 'C' || $row['id_msg'] != $page_id) |
936 | 962 | { |
937 | - if (!empty($row['id_member'])) |
|
938 | - $all_posters[$row['id_msg']] = $row['id_member']; |
|
963 | + if (!empty($row['id_member'])) { |
|
964 | + $all_posters[$row['id_msg']] = $row['id_member']; |
|
965 | + } |
|
939 | 966 | |
940 | 967 | $messages[] = $row['id_msg']; |
941 | 968 | } |
@@ -951,8 +978,9 @@ discard block |
||
951 | 978 | } |
952 | 979 | |
953 | 980 | // Before Page bring in the right order |
954 | - if (!empty($start_char) && $start_char === 'L') |
|
955 | - krsort($messages); |
|
981 | + if (!empty($start_char) && $start_char === 'L') { |
|
982 | + krsort($messages); |
|
983 | + } |
|
956 | 984 | } |
957 | 985 | |
958 | 986 | // Jump to page |
@@ -989,14 +1017,16 @@ discard block |
||
989 | 1017 | |
990 | 1018 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
991 | 1019 | { |
992 | - if (!empty($row['id_member'])) |
|
993 | - $all_posters[$row['id_msg']] = $row['id_member']; |
|
1020 | + if (!empty($row['id_member'])) { |
|
1021 | + $all_posters[$row['id_msg']] = $row['id_member']; |
|
1022 | + } |
|
994 | 1023 | $messages[] = $row['id_msg']; |
995 | 1024 | } |
996 | 1025 | |
997 | 1026 | // Sort the messages into the correct display order |
998 | - if (!$ascending) |
|
999 | - sort($messages); |
|
1027 | + if (!$ascending) { |
|
1028 | + sort($messages); |
|
1029 | + } |
|
1000 | 1030 | } |
1001 | 1031 | |
1002 | 1032 | // Remember the paging data for next time |
@@ -1016,8 +1046,9 @@ discard block |
||
1016 | 1046 | if (!$user_info['is_guest'] && !empty($messages)) |
1017 | 1047 | { |
1018 | 1048 | $mark_at_msg = max($messages); |
1019 | - if ($mark_at_msg >= $context['topicinfo']['id_last_msg']) |
|
1020 | - $mark_at_msg = $modSettings['maxMsgID']; |
|
1049 | + if ($mark_at_msg >= $context['topicinfo']['id_last_msg']) { |
|
1050 | + $mark_at_msg = $modSettings['maxMsgID']; |
|
1051 | + } |
|
1021 | 1052 | if ($mark_at_msg >= $context['topicinfo']['new_from']) |
1022 | 1053 | { |
1023 | 1054 | $smcFunc['db_insert']($context['topicinfo']['new_from'] == 0 ? 'ignore' : 'replace', |
@@ -1049,8 +1080,9 @@ discard block |
||
1049 | 1080 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1050 | 1081 | { |
1051 | 1082 | // Find if this topic is marked for notification... |
1052 | - if (!empty($row['id_topic'])) |
|
1053 | - $context['is_marked_notify'] = true; |
|
1083 | + if (!empty($row['id_topic'])) { |
|
1084 | + $context['is_marked_notify'] = true; |
|
1085 | + } |
|
1054 | 1086 | |
1055 | 1087 | // Only do this once, but mark the notifications as "not sent yet" for next time. |
1056 | 1088 | if (!empty($row['sent']) && $do_once) |
@@ -1072,8 +1104,9 @@ discard block |
||
1072 | 1104 | } |
1073 | 1105 | |
1074 | 1106 | // Have we recently cached the number of new topics in this board, and it's still a lot? |
1075 | - if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5) |
|
1076 | - $_SESSION['topicseen_cache'][$board]--; |
|
1107 | + if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5) { |
|
1108 | + $_SESSION['topicseen_cache'][$board]--; |
|
1109 | + } |
|
1077 | 1110 | // Mark board as seen if this is the only new topic. |
1078 | 1111 | elseif (isset($_REQUEST['topicseen'])) |
1079 | 1112 | { |
@@ -1097,14 +1130,16 @@ discard block |
||
1097 | 1130 | $smcFunc['db_free_result']($request); |
1098 | 1131 | |
1099 | 1132 | // If there're no real new topics in this board, mark the board as seen. |
1100 | - if (empty($numNewTopics)) |
|
1101 | - $_REQUEST['boardseen'] = true; |
|
1102 | - else |
|
1103 | - $_SESSION['topicseen_cache'][$board] = $numNewTopics; |
|
1133 | + if (empty($numNewTopics)) { |
|
1134 | + $_REQUEST['boardseen'] = true; |
|
1135 | + } else { |
|
1136 | + $_SESSION['topicseen_cache'][$board] = $numNewTopics; |
|
1137 | + } |
|
1104 | 1138 | } |
1105 | 1139 | // Probably one less topic - maybe not, but even if we decrease this too fast it will only make us look more often. |
1106 | - elseif (isset($_SESSION['topicseen_cache'][$board])) |
|
1107 | - $_SESSION['topicseen_cache'][$board]--; |
|
1140 | + elseif (isset($_SESSION['topicseen_cache'][$board])) { |
|
1141 | + $_SESSION['topicseen_cache'][$board]--; |
|
1142 | + } |
|
1108 | 1143 | |
1109 | 1144 | // Mark board as seen if we came using last post link from BoardIndex. (or other places...) |
1110 | 1145 | if (isset($_REQUEST['boardseen'])) |
@@ -1161,23 +1196,26 @@ discard block |
||
1161 | 1196 | $temp = array(); |
1162 | 1197 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1163 | 1198 | { |
1164 | - if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id'])) |
|
1165 | - continue; |
|
1199 | + if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id'])) { |
|
1200 | + continue; |
|
1201 | + } |
|
1166 | 1202 | |
1167 | 1203 | $temp[$row['id_attach']] = $row; |
1168 | 1204 | $temp[$row['id_attach']]['topic'] = $topic; |
1169 | 1205 | $temp[$row['id_attach']]['board'] = $board; |
1170 | 1206 | |
1171 | - if (!isset($context['loaded_attachments'][$row['id_msg']])) |
|
1172 | - $context['loaded_attachments'][$row['id_msg']] = array(); |
|
1207 | + if (!isset($context['loaded_attachments'][$row['id_msg']])) { |
|
1208 | + $context['loaded_attachments'][$row['id_msg']] = array(); |
|
1209 | + } |
|
1173 | 1210 | } |
1174 | 1211 | $smcFunc['db_free_result']($request); |
1175 | 1212 | |
1176 | 1213 | // This is better than sorting it with the query... |
1177 | 1214 | ksort($temp); |
1178 | 1215 | |
1179 | - foreach ($temp as $row) |
|
1180 | - $context['loaded_attachments'][$row['id_msg']][] = $row; |
|
1216 | + foreach ($temp as $row) { |
|
1217 | + $context['loaded_attachments'][$row['id_msg']][] = $row; |
|
1218 | + } |
|
1181 | 1219 | } |
1182 | 1220 | |
1183 | 1221 | $msg_parameters = array( |
@@ -1204,21 +1242,23 @@ discard block |
||
1204 | 1242 | ); |
1205 | 1243 | |
1206 | 1244 | // And the likes |
1207 | - if (!empty($modSettings['enable_likes'])) |
|
1208 | - $context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic); |
|
1245 | + if (!empty($modSettings['enable_likes'])) { |
|
1246 | + $context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic); |
|
1247 | + } |
|
1209 | 1248 | |
1210 | 1249 | // Go to the last message if the given time is beyond the time of the last message. |
1211 | - if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies']) |
|
1212 | - $context['start_from'] = $context['topicinfo']['num_replies']; |
|
1250 | + if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies']) { |
|
1251 | + $context['start_from'] = $context['topicinfo']['num_replies']; |
|
1252 | + } |
|
1213 | 1253 | |
1214 | 1254 | // Since the anchor information is needed on the top of the page we load these variables beforehand. |
1215 | 1255 | $context['first_message'] = isset($messages[$firstIndex]) ? $messages[$firstIndex] : $messages[0]; |
1216 | - if (empty($options['view_newest_first'])) |
|
1217 | - $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from']; |
|
1218 | - else |
|
1219 | - $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from']; |
|
1220 | - } |
|
1221 | - else |
|
1256 | + if (empty($options['view_newest_first'])) { |
|
1257 | + $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from']; |
|
1258 | + } else { |
|
1259 | + $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from']; |
|
1260 | + } |
|
1261 | + } else |
|
1222 | 1262 | { |
1223 | 1263 | $messages_request = false; |
1224 | 1264 | $context['first_message'] = 0; |
@@ -1253,8 +1293,9 @@ discard block |
||
1253 | 1293 | 'can_restore_msg' => 'move_any', |
1254 | 1294 | 'can_like' => 'likes_like', |
1255 | 1295 | ); |
1256 | - foreach ($common_permissions as $contextual => $perm) |
|
1257 | - $context[$contextual] = allowedTo($perm); |
|
1296 | + foreach ($common_permissions as $contextual => $perm) { |
|
1297 | + $context[$contextual] = allowedTo($perm); |
|
1298 | + } |
|
1258 | 1299 | |
1259 | 1300 | // Permissions with _any/_own versions. $context[YYY] => ZZZ_any/_own. |
1260 | 1301 | $anyown_permissions = array( |
@@ -1267,8 +1308,9 @@ discard block |
||
1267 | 1308 | 'can_reply_unapproved' => 'post_unapproved_replies', |
1268 | 1309 | 'can_view_warning' => 'profile_warning', |
1269 | 1310 | ); |
1270 | - foreach ($anyown_permissions as $contextual => $perm) |
|
1271 | - $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); |
|
1311 | + foreach ($anyown_permissions as $contextual => $perm) { |
|
1312 | + $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); |
|
1313 | + } |
|
1272 | 1314 | |
1273 | 1315 | if (!$user_info['is_admin'] && !$modSettings['topic_move_any']) |
1274 | 1316 | { |
@@ -1314,8 +1356,9 @@ discard block |
||
1314 | 1356 | // Check if the draft functions are enabled and that they have permission to use them (for quick reply.) |
1315 | 1357 | $context['drafts_save'] = !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft') && $context['can_reply']; |
1316 | 1358 | $context['drafts_autosave'] = !empty($context['drafts_save']) && !empty($modSettings['drafts_autosave_enabled']); |
1317 | - if (!empty($context['drafts_save'])) |
|
1318 | - loadLanguage('Drafts'); |
|
1359 | + if (!empty($context['drafts_save'])) { |
|
1360 | + loadLanguage('Drafts'); |
|
1361 | + } |
|
1319 | 1362 | |
1320 | 1363 | // When was the last time this topic was replied to? Should we warn them about it? |
1321 | 1364 | if (!empty($modSettings['oldTopicDays']) && ($context['can_reply'] || $context['can_reply_unapproved']) && empty($context['topicinfo']['is_sticky'])) |
@@ -1376,26 +1419,31 @@ discard block |
||
1376 | 1419 | // Message icons - customized icons are off? |
1377 | 1420 | $context['icons'] = getMessageIcons($board); |
1378 | 1421 | |
1379 | - if (!empty($context['icons'])) |
|
1380 | - $context['icons'][count($context['icons']) - 1]['is_last'] = true; |
|
1422 | + if (!empty($context['icons'])) { |
|
1423 | + $context['icons'][count($context['icons']) - 1]['is_last'] = true; |
|
1424 | + } |
|
1381 | 1425 | |
1382 | 1426 | // Build the normal button array. |
1383 | 1427 | $context['normal_buttons'] = array(); |
1384 | 1428 | |
1385 | - if ($context['can_reply']) |
|
1386 | - $context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true); |
|
1429 | + if ($context['can_reply']) { |
|
1430 | + $context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true); |
|
1431 | + } |
|
1387 | 1432 | |
1388 | - if ($context['can_add_poll']) |
|
1389 | - $context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
1433 | + if ($context['can_add_poll']) { |
|
1434 | + $context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
1435 | + } |
|
1390 | 1436 | |
1391 | - if ($context['can_mark_unread']) |
|
1392 | - $context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1437 | + if ($context['can_mark_unread']) { |
|
1438 | + $context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1439 | + } |
|
1393 | 1440 | |
1394 | - if ($context['can_print']) |
|
1395 | - $context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'); |
|
1441 | + if ($context['can_print']) { |
|
1442 | + $context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'); |
|
1443 | + } |
|
1396 | 1444 | |
1397 | - if ($context['can_set_notify']) |
|
1398 | - $context['normal_buttons']['notify'] = array( |
|
1445 | + if ($context['can_set_notify']) { |
|
1446 | + $context['normal_buttons']['notify'] = array( |
|
1399 | 1447 | 'text' => 'notify_topic_' . $context['topic_notification_mode'], |
1400 | 1448 | 'sub_buttons' => array( |
1401 | 1449 | array( |
@@ -1417,38 +1465,47 @@ discard block |
||
1417 | 1465 | ), |
1418 | 1466 | ), |
1419 | 1467 | ); |
1468 | + } |
|
1420 | 1469 | |
1421 | 1470 | // Build the mod button array |
1422 | 1471 | $context['mod_buttons'] = array(); |
1423 | 1472 | |
1424 | - if ($context['can_move']) |
|
1425 | - $context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1473 | + if ($context['can_move']) { |
|
1474 | + $context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1475 | + } |
|
1426 | 1476 | |
1427 | - if ($context['can_delete']) |
|
1428 | - $context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
1477 | + if ($context['can_delete']) { |
|
1478 | + $context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
1479 | + } |
|
1429 | 1480 | |
1430 | - if ($context['can_lock']) |
|
1431 | - $context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1481 | + if ($context['can_lock']) { |
|
1482 | + $context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1483 | + } |
|
1432 | 1484 | |
1433 | - if ($context['can_sticky']) |
|
1434 | - $context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1485 | + if ($context['can_sticky']) { |
|
1486 | + $context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1487 | + } |
|
1435 | 1488 | |
1436 | - if ($context['can_merge']) |
|
1437 | - $context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']); |
|
1489 | + if ($context['can_merge']) { |
|
1490 | + $context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']); |
|
1491 | + } |
|
1438 | 1492 | |
1439 | - if ($context['calendar_post']) |
|
1440 | - $context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1493 | + if ($context['calendar_post']) { |
|
1494 | + $context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1495 | + } |
|
1441 | 1496 | |
1442 | 1497 | // Restore topic. eh? No monkey business. |
1443 | - if ($context['can_restore_topic']) |
|
1444 | - $context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1498 | + if ($context['can_restore_topic']) { |
|
1499 | + $context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1500 | + } |
|
1445 | 1501 | |
1446 | 1502 | // Show a message in case a recently posted message became unapproved. |
1447 | 1503 | $context['becomesUnapproved'] = !empty($_SESSION['becomesUnapproved']) ? true : false; |
1448 | 1504 | |
1449 | 1505 | // Don't want to show this forever... |
1450 | - if ($context['becomesUnapproved']) |
|
1451 | - unset($_SESSION['becomesUnapproved']); |
|
1506 | + if ($context['becomesUnapproved']) { |
|
1507 | + unset($_SESSION['becomesUnapproved']); |
|
1508 | + } |
|
1452 | 1509 | |
1453 | 1510 | // Allow adding new mod buttons easily. |
1454 | 1511 | // Note: $context['normal_buttons'] and $context['mod_buttons'] are added for backward compatibility with 2.0, but are deprecated and should not be used |
@@ -1457,12 +1514,14 @@ discard block |
||
1457 | 1514 | call_integration_hook('integrate_mod_buttons', array(&$context['mod_buttons'])); |
1458 | 1515 | |
1459 | 1516 | // Load the drafts js file |
1460 | - if ($context['drafts_autosave']) |
|
1461 | - loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts'); |
|
1517 | + if ($context['drafts_autosave']) { |
|
1518 | + loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts'); |
|
1519 | + } |
|
1462 | 1520 | |
1463 | 1521 | // Spellcheck |
1464 | - if ($context['show_spellchecking']) |
|
1465 | - loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
1522 | + if ($context['show_spellchecking']) { |
|
1523 | + loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
1524 | + } |
|
1466 | 1525 | |
1467 | 1526 | // topic.js |
1468 | 1527 | loadJavaScriptFile('topic.js', array('defer' => false), 'smf_topic'); |
@@ -1496,16 +1555,19 @@ discard block |
||
1496 | 1555 | static $counter = null; |
1497 | 1556 | |
1498 | 1557 | // If the query returned false, bail. |
1499 | - if ($messages_request == false) |
|
1500 | - return false; |
|
1558 | + if ($messages_request == false) { |
|
1559 | + return false; |
|
1560 | + } |
|
1501 | 1561 | |
1502 | 1562 | // Remember which message this is. (ie. reply #83) |
1503 | - if ($counter === null || $reset) |
|
1504 | - $counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start']; |
|
1563 | + if ($counter === null || $reset) { |
|
1564 | + $counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start']; |
|
1565 | + } |
|
1505 | 1566 | |
1506 | 1567 | // Start from the beginning... |
1507 | - if ($reset) |
|
1508 | - return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1568 | + if ($reset) { |
|
1569 | + return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1570 | + } |
|
1509 | 1571 | |
1510 | 1572 | // Attempt to get the next message. |
1511 | 1573 | $message = $smcFunc['db_fetch_assoc']($messages_request); |
@@ -1519,19 +1581,21 @@ discard block |
||
1519 | 1581 | if (empty($context['icon_sources'])) |
1520 | 1582 | { |
1521 | 1583 | $context['icon_sources'] = array(); |
1522 | - foreach ($context['stable_icons'] as $icon) |
|
1523 | - $context['icon_sources'][$icon] = 'images_url'; |
|
1584 | + foreach ($context['stable_icons'] as $icon) { |
|
1585 | + $context['icon_sources'][$icon] = 'images_url'; |
|
1586 | + } |
|
1524 | 1587 | } |
1525 | 1588 | |
1526 | 1589 | // Message Icon Management... check the images exist. |
1527 | 1590 | if (empty($modSettings['messageIconChecks_disable'])) |
1528 | 1591 | { |
1529 | 1592 | // If the current icon isn't known, then we need to do something... |
1530 | - if (!isset($context['icon_sources'][$message['icon']])) |
|
1531 | - $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
1593 | + if (!isset($context['icon_sources'][$message['icon']])) { |
|
1594 | + $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
1595 | + } |
|
1596 | + } elseif (!isset($context['icon_sources'][$message['icon']])) { |
|
1597 | + $context['icon_sources'][$message['icon']] = 'images_url'; |
|
1532 | 1598 | } |
1533 | - elseif (!isset($context['icon_sources'][$message['icon']])) |
|
1534 | - $context['icon_sources'][$message['icon']] = 'images_url'; |
|
1535 | 1599 | |
1536 | 1600 | // If you're a lazy bum, you probably didn't give a subject... |
1537 | 1601 | $message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject']; |
@@ -1556,8 +1620,7 @@ discard block |
||
1556 | 1620 | $memberContext[$message['id_member']]['email'] = $message['poster_email']; |
1557 | 1621 | $memberContext[$message['id_member']]['show_email'] = allowedTo('moderate_forum'); |
1558 | 1622 | $memberContext[$message['id_member']]['is_guest'] = true; |
1559 | - } |
|
1560 | - else |
|
1623 | + } else |
|
1561 | 1624 | { |
1562 | 1625 | // Define this here to make things a bit more readable |
1563 | 1626 | $can_view_warning = $context['user']['can_mod'] || allowedTo('view_warning_any') || ($message['id_member'] == $user_info['id'] && allowedTo('view_warning_own')); |
@@ -1580,8 +1643,9 @@ discard block |
||
1580 | 1643 | $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']); |
1581 | 1644 | |
1582 | 1645 | // If it's in the recycle bin we need to override whatever icon we did have. |
1583 | - if (!empty($board_info['recycle'])) |
|
1584 | - $message['icon'] = 'recycled'; |
|
1646 | + if (!empty($board_info['recycle'])) { |
|
1647 | + $message['icon'] = 'recycled'; |
|
1648 | + } |
|
1585 | 1649 | |
1586 | 1650 | require_once($sourcedir . '/Subs-Attachments.php'); |
1587 | 1651 | |
@@ -1625,32 +1689,36 @@ discard block |
||
1625 | 1689 | } |
1626 | 1690 | |
1627 | 1691 | // Are likes enable? |
1628 | - if (!empty($modSettings['enable_likes'])) |
|
1629 | - $output['likes'] = array( |
|
1692 | + if (!empty($modSettings['enable_likes'])) { |
|
1693 | + $output['likes'] = array( |
|
1630 | 1694 | 'count' => $message['likes'], |
1631 | 1695 | 'you' => in_array($message['id_msg'], $context['my_likes']), |
1632 | 1696 | 'can_like' => !$context['user']['is_guest'] && $message['id_member'] != $context['user']['id'] && !empty($context['can_like']), |
1633 | 1697 | ); |
1698 | + } |
|
1634 | 1699 | |
1635 | 1700 | // Is this user the message author? |
1636 | 1701 | $output['is_message_author'] = $message['id_member'] == $user_info['id']; |
1637 | - if (!empty($output['modified']['name'])) |
|
1638 | - $output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']); |
|
1702 | + if (!empty($output['modified']['name'])) { |
|
1703 | + $output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']); |
|
1704 | + } |
|
1639 | 1705 | |
1640 | 1706 | // Did they give a reason for editing? |
1641 | - if (!empty($output['modified']['name']) && !empty($output['modified']['reason'])) |
|
1642 | - $output['modified']['last_edit_text'] .= ' ' . sprintf($txt['last_edit_reason'], $output['modified']['reason']); |
|
1707 | + if (!empty($output['modified']['name']) && !empty($output['modified']['reason'])) { |
|
1708 | + $output['modified']['last_edit_text'] .= ' ' . sprintf($txt['last_edit_reason'], $output['modified']['reason']); |
|
1709 | + } |
|
1643 | 1710 | |
1644 | 1711 | // Any custom profile fields? |
1645 | - if (!empty($memberContext[$message['id_member']]['custom_fields'])) |
|
1646 | - foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom) |
|
1712 | + if (!empty($memberContext[$message['id_member']]['custom_fields'])) { |
|
1713 | + foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom) |
|
1647 | 1714 | $output['custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom; |
1715 | + } |
|
1648 | 1716 | |
1649 | - if (empty($options['view_newest_first'])) |
|
1650 | - $counter++; |
|
1651 | - |
|
1652 | - else |
|
1653 | - $counter--; |
|
1717 | + if (empty($options['view_newest_first'])) { |
|
1718 | + $counter++; |
|
1719 | + } else { |
|
1720 | + $counter--; |
|
1721 | + } |
|
1654 | 1722 | |
1655 | 1723 | call_integration_hook('integrate_prepare_display_context', array(&$output, &$message, $counter)); |
1656 | 1724 | |
@@ -1676,21 +1744,23 @@ discard block |
||
1676 | 1744 | $context['no_last_modified'] = true; |
1677 | 1745 | |
1678 | 1746 | // Prevent a preview image from being displayed twice. |
1679 | - if (isset($_GET['action']) && $_GET['action'] == 'dlattach' && isset($_GET['type']) && ($_GET['type'] == 'avatar' || $_GET['type'] == 'preview')) |
|
1680 | - return; |
|
1747 | + if (isset($_GET['action']) && $_GET['action'] == 'dlattach' && isset($_GET['type']) && ($_GET['type'] == 'avatar' || $_GET['type'] == 'preview')) { |
|
1748 | + return; |
|
1749 | + } |
|
1681 | 1750 | |
1682 | 1751 | // Make sure some attachment was requested! |
1683 | - if (!isset($_REQUEST['attach']) && !isset($_REQUEST['id'])) |
|
1684 | - fatal_lang_error('no_access', false); |
|
1752 | + if (!isset($_REQUEST['attach']) && !isset($_REQUEST['id'])) { |
|
1753 | + fatal_lang_error('no_access', false); |
|
1754 | + } |
|
1685 | 1755 | |
1686 | 1756 | $_REQUEST['attach'] = isset($_REQUEST['attach']) ? (int) $_REQUEST['attach'] : (int) $_REQUEST['id']; |
1687 | 1757 | |
1688 | 1758 | // Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request. |
1689 | 1759 | $attachRequest = null; |
1690 | 1760 | call_integration_hook('integrate_download_request', array(&$attachRequest)); |
1691 | - if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) |
|
1692 | - $request = $attachRequest; |
|
1693 | - else |
|
1761 | + if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) { |
|
1762 | + $request = $attachRequest; |
|
1763 | + } else |
|
1694 | 1764 | { |
1695 | 1765 | // This checks only the current board for $board/$topic's permissions. |
1696 | 1766 | isAllowedTo('view_attachments'); |
@@ -1711,19 +1781,21 @@ discard block |
||
1711 | 1781 | ); |
1712 | 1782 | } |
1713 | 1783 | |
1714 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
1715 | - fatal_lang_error('no_access', false); |
|
1784 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1785 | + fatal_lang_error('no_access', false); |
|
1786 | + } |
|
1716 | 1787 | |
1717 | 1788 | list ($id_folder, $real_filename, $file_hash, $file_ext, $id_attach, $attachment_type, $mime_type, $is_approved, $id_member) = $smcFunc['db_fetch_row']($request); |
1718 | 1789 | $smcFunc['db_free_result']($request); |
1719 | 1790 | |
1720 | 1791 | // If it isn't yet approved, do they have permission to view it? |
1721 | - if (!$is_approved && ($id_member == 0 || $user_info['id'] != $id_member) && ($attachment_type == 0 || $attachment_type == 3)) |
|
1722 | - isAllowedTo('approve_posts'); |
|
1792 | + if (!$is_approved && ($id_member == 0 || $user_info['id'] != $id_member) && ($attachment_type == 0 || $attachment_type == 3)) { |
|
1793 | + isAllowedTo('approve_posts'); |
|
1794 | + } |
|
1723 | 1795 | |
1724 | 1796 | // Update the download counter (unless it's a thumbnail). |
1725 | - if ($attachment_type != 3) |
|
1726 | - $smcFunc['db_query']('attach_download_increase', ' |
|
1797 | + if ($attachment_type != 3) { |
|
1798 | + $smcFunc['db_query']('attach_download_increase', ' |
|
1727 | 1799 | UPDATE LOW_PRIORITY {db_prefix}attachments |
1728 | 1800 | SET downloads = downloads + 1 |
1729 | 1801 | WHERE id_attach = {int:id_attach}', |
@@ -1731,15 +1803,15 @@ discard block |
||
1731 | 1803 | 'id_attach' => $id_attach, |
1732 | 1804 | ) |
1733 | 1805 | ); |
1806 | + } |
|
1734 | 1807 | |
1735 | 1808 | $filename = getAttachmentFilename($real_filename, $_REQUEST['attach'], $id_folder, false, $file_hash); |
1736 | 1809 | |
1737 | 1810 | // This is done to clear any output that was made before now. |
1738 | 1811 | ob_end_clean(); |
1739 | - if (!empty($modSettings['enableCompressedOutput']) && @filesize($filename) <= 4194304 && in_array($file_ext, array('txt', 'html', 'htm', 'js', 'doc', 'docx', 'rtf', 'css', 'php', 'log', 'xml', 'sql', 'c', 'java'))) |
|
1740 | - @ob_start('ob_gzhandler'); |
|
1741 | - |
|
1742 | - else |
|
1812 | + if (!empty($modSettings['enableCompressedOutput']) && @filesize($filename) <= 4194304 && in_array($file_ext, array('txt', 'html', 'htm', 'js', 'doc', 'docx', 'rtf', 'css', 'php', 'log', 'xml', 'sql', 'c', 'java'))) { |
|
1813 | + @ob_start('ob_gzhandler'); |
|
1814 | + } else |
|
1743 | 1815 | { |
1744 | 1816 | ob_start(); |
1745 | 1817 | header('Content-Encoding: none'); |
@@ -1782,8 +1854,9 @@ discard block |
||
1782 | 1854 | // Send the attachment headers. |
1783 | 1855 | header('Pragma: '); |
1784 | 1856 | |
1785 | - if (!isBrowser('gecko')) |
|
1786 | - header('Content-Transfer-Encoding: binary'); |
|
1857 | + if (!isBrowser('gecko')) { |
|
1858 | + header('Content-Transfer-Encoding: binary'); |
|
1859 | + } |
|
1787 | 1860 | |
1788 | 1861 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
1789 | 1862 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filename)) . ' GMT'); |
@@ -1792,18 +1865,19 @@ discard block |
||
1792 | 1865 | header('ETag: ' . $eTag); |
1793 | 1866 | |
1794 | 1867 | // Make sure the mime type warrants an inline display. |
1795 | - if (isset($_REQUEST['image']) && !empty($mime_type) && strpos($mime_type, 'image/') !== 0) |
|
1796 | - unset($_REQUEST['image']); |
|
1868 | + if (isset($_REQUEST['image']) && !empty($mime_type) && strpos($mime_type, 'image/') !== 0) { |
|
1869 | + unset($_REQUEST['image']); |
|
1870 | + } |
|
1797 | 1871 | |
1798 | 1872 | // Does this have a mime type? |
1799 | - elseif (!empty($mime_type) && (isset($_REQUEST['image']) || !in_array($file_ext, array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) |
|
1800 | - header('Content-Type: ' . strtr($mime_type, array('image/bmp' => 'image/x-ms-bmp'))); |
|
1801 | - |
|
1802 | - else |
|
1873 | + elseif (!empty($mime_type) && (isset($_REQUEST['image']) || !in_array($file_ext, array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) { |
|
1874 | + header('Content-Type: ' . strtr($mime_type, array('image/bmp' => 'image/x-ms-bmp'))); |
|
1875 | + } else |
|
1803 | 1876 | { |
1804 | 1877 | header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream')); |
1805 | - if (isset($_REQUEST['image'])) |
|
1806 | - unset($_REQUEST['image']); |
|
1878 | + if (isset($_REQUEST['image'])) { |
|
1879 | + unset($_REQUEST['image']); |
|
1880 | + } |
|
1807 | 1881 | } |
1808 | 1882 | |
1809 | 1883 | // Convert the file to UTF-8, cuz most browsers dig that. |
@@ -1811,23 +1885,22 @@ discard block |
||
1811 | 1885 | $disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline'; |
1812 | 1886 | |
1813 | 1887 | // Different browsers like different standards... |
1814 | - if (isBrowser('firefox')) |
|
1815 | - header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
1816 | - |
|
1817 | - elseif (isBrowser('opera')) |
|
1818 | - header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
1819 | - |
|
1820 | - elseif (isBrowser('ie')) |
|
1821 | - header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
1822 | - |
|
1823 | - else |
|
1824 | - header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
1888 | + if (isBrowser('firefox')) { |
|
1889 | + header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
1890 | + } elseif (isBrowser('opera')) { |
|
1891 | + header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
1892 | + } elseif (isBrowser('ie')) { |
|
1893 | + header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
1894 | + } else { |
|
1895 | + header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
1896 | + } |
|
1825 | 1897 | |
1826 | 1898 | // If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE. |
1827 | - if (!isset($_REQUEST['image']) && in_array($file_ext, array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) |
|
1828 | - header('Cache-Control: no-cache'); |
|
1829 | - else |
|
1830 | - header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
1899 | + if (!isset($_REQUEST['image']) && in_array($file_ext, array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) { |
|
1900 | + header('Cache-Control: no-cache'); |
|
1901 | + } else { |
|
1902 | + header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
1903 | + } |
|
1831 | 1904 | |
1832 | 1905 | header('Content-Length: ' . filesize($filename)); |
1833 | 1906 | |
@@ -1837,20 +1910,23 @@ discard block |
||
1837 | 1910 | // Recode line endings for text files, if enabled. |
1838 | 1911 | if (!empty($modSettings['attachmentRecodeLineEndings']) && !isset($_REQUEST['image']) && in_array($file_ext, array('txt', 'css', 'htm', 'html', 'php', 'xml'))) |
1839 | 1912 | { |
1840 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) |
|
1841 | - $callback = function($buffer) |
|
1913 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) { |
|
1914 | + $callback = function($buffer) |
|
1842 | 1915 | { |
1843 | 1916 | return preg_replace('~[\r]?\n~', "\r\n", $buffer); |
1917 | + } |
|
1844 | 1918 | }; |
1845 | - elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) |
|
1846 | - $callback = function($buffer) |
|
1919 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) { |
|
1920 | + $callback = function($buffer) |
|
1847 | 1921 | { |
1848 | 1922 | return preg_replace('~[\r]?\n~', "\r", $buffer); |
1923 | + } |
|
1849 | 1924 | }; |
1850 | - else |
|
1851 | - $callback = function($buffer) |
|
1925 | + else { |
|
1926 | + $callback = function($buffer) |
|
1852 | 1927 | { |
1853 | 1928 | return preg_replace('~[\r]?\n~', "\n", $buffer); |
1929 | + } |
|
1854 | 1930 | }; |
1855 | 1931 | } |
1856 | 1932 | |
@@ -1858,23 +1934,26 @@ discard block |
||
1858 | 1934 | if (filesize($filename) > 4194304) |
1859 | 1935 | { |
1860 | 1936 | // Forcibly end any output buffering going on. |
1861 | - while (@ob_get_level() > 0) |
|
1862 | - @ob_end_clean(); |
|
1937 | + while (@ob_get_level() > 0) { |
|
1938 | + @ob_end_clean(); |
|
1939 | + } |
|
1863 | 1940 | |
1864 | 1941 | $fp = fopen($filename, 'rb'); |
1865 | 1942 | while (!feof($fp)) |
1866 | 1943 | { |
1867 | - if (isset($callback)) |
|
1868 | - echo $callback(fread($fp, 8192)); |
|
1869 | - else |
|
1870 | - echo fread($fp, 8192); |
|
1944 | + if (isset($callback)) { |
|
1945 | + echo $callback(fread($fp, 8192)); |
|
1946 | + } else { |
|
1947 | + echo fread($fp, 8192); |
|
1948 | + } |
|
1871 | 1949 | flush(); |
1872 | 1950 | } |
1873 | 1951 | fclose($fp); |
1874 | 1952 | } |
1875 | 1953 | // On some of the less-bright hosts, readfile() is disabled. It's just a faster, more byte safe, version of what's in the if. |
1876 | - elseif (isset($callback) || @readfile($filename) === null) |
|
1877 | - echo isset($callback) ? $callback(file_get_contents($filename)) : file_get_contents($filename); |
|
1954 | + elseif (isset($callback) || @readfile($filename) === null) { |
|
1955 | + echo isset($callback) ? $callback(file_get_contents($filename)) : file_get_contents($filename); |
|
1956 | + } |
|
1878 | 1957 | |
1879 | 1958 | obExit(false); |
1880 | 1959 | } |
@@ -1887,8 +1966,9 @@ discard block |
||
1887 | 1966 | */ |
1888 | 1967 | function approved_attach_sort($a, $b) |
1889 | 1968 | { |
1890 | - if ($a['is_approved'] == $b['is_approved']) |
|
1891 | - return 0; |
|
1969 | + if ($a['is_approved'] == $b['is_approved']) { |
|
1970 | + return 0; |
|
1971 | + } |
|
1892 | 1972 | |
1893 | 1973 | return $a['is_approved'] > $b['is_approved'] ? -1 : 1; |
1894 | 1974 | } |
@@ -1905,16 +1985,19 @@ discard block |
||
1905 | 1985 | |
1906 | 1986 | require_once($sourcedir . '/RemoveTopic.php'); |
1907 | 1987 | |
1908 | - if (empty($_REQUEST['msgs'])) |
|
1909 | - redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
1988 | + if (empty($_REQUEST['msgs'])) { |
|
1989 | + redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
1990 | + } |
|
1910 | 1991 | |
1911 | 1992 | $messages = array(); |
1912 | - foreach ($_REQUEST['msgs'] as $dummy) |
|
1913 | - $messages[] = (int) $dummy; |
|
1993 | + foreach ($_REQUEST['msgs'] as $dummy) { |
|
1994 | + $messages[] = (int) $dummy; |
|
1995 | + } |
|
1914 | 1996 | |
1915 | 1997 | // We are restoring messages. We handle this in another place. |
1916 | - if (isset($_REQUEST['restore_selected'])) |
|
1917 | - redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1998 | + if (isset($_REQUEST['restore_selected'])) { |
|
1999 | + redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
2000 | + } |
|
1918 | 2001 | if (isset($_REQUEST['split_selection'])) |
1919 | 2002 | { |
1920 | 2003 | $request = $smcFunc['db_query']('', ' |
@@ -1933,8 +2016,9 @@ discard block |
||
1933 | 2016 | } |
1934 | 2017 | |
1935 | 2018 | // Allowed to delete any message? |
1936 | - if (allowedTo('delete_any')) |
|
1937 | - $allowed_all = true; |
|
2019 | + if (allowedTo('delete_any')) { |
|
2020 | + $allowed_all = true; |
|
2021 | + } |
|
1938 | 2022 | // Allowed to delete replies to their messages? |
1939 | 2023 | elseif (allowedTo('delete_replies')) |
1940 | 2024 | { |
@@ -1951,13 +2035,14 @@ discard block |
||
1951 | 2035 | $smcFunc['db_free_result']($request); |
1952 | 2036 | |
1953 | 2037 | $allowed_all = $starter == $user_info['id']; |
2038 | + } else { |
|
2039 | + $allowed_all = false; |
|
1954 | 2040 | } |
1955 | - else |
|
1956 | - $allowed_all = false; |
|
1957 | 2041 | |
1958 | 2042 | // Make sure they're allowed to delete their own messages, if not any. |
1959 | - if (!$allowed_all) |
|
1960 | - isAllowedTo('delete_own'); |
|
2043 | + if (!$allowed_all) { |
|
2044 | + isAllowedTo('delete_own'); |
|
2045 | + } |
|
1961 | 2046 | |
1962 | 2047 | // Allowed to remove which messages? |
1963 | 2048 | $request = $smcFunc['db_query']('', ' |
@@ -1977,8 +2062,9 @@ discard block |
||
1977 | 2062 | $messages = array(); |
1978 | 2063 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1979 | 2064 | { |
1980 | - if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time()) |
|
1981 | - continue; |
|
2065 | + if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time()) { |
|
2066 | + continue; |
|
2067 | + } |
|
1982 | 2068 | |
1983 | 2069 | $messages[$row['id_msg']] = array($row['subject'], $row['id_member']); |
1984 | 2070 | } |
@@ -2001,17 +2087,20 @@ discard block |
||
2001 | 2087 | foreach ($messages as $message => $info) |
2002 | 2088 | { |
2003 | 2089 | // Just skip the first message - if it's not the last. |
2004 | - if ($message == $first_message && $message != $last_message) |
|
2005 | - continue; |
|
2090 | + if ($message == $first_message && $message != $last_message) { |
|
2091 | + continue; |
|
2092 | + } |
|
2006 | 2093 | // If the first message is going then don't bother going back to the topic as we're effectively deleting it. |
2007 | - elseif ($message == $first_message) |
|
2008 | - $topicGone = true; |
|
2094 | + elseif ($message == $first_message) { |
|
2095 | + $topicGone = true; |
|
2096 | + } |
|
2009 | 2097 | |
2010 | 2098 | removeMessage($message); |
2011 | 2099 | |
2012 | 2100 | // Log this moderation action ;). |
2013 | - if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) |
|
2014 | - logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board)); |
|
2101 | + if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) { |
|
2102 | + logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board)); |
|
2103 | + } |
|
2015 | 2104 | } |
2016 | 2105 | |
2017 | 2106 | redirectexit(!empty($topicGone) ? 'board=' . $board : 'topic=' . $topic . '.' . $_REQUEST['start']); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $query_where = array(); |
167 | 167 | $query_params = $search_data['params']; |
168 | 168 | |
169 | - if( $smcFunc['db_title'] == "PostgreSQL") |
|
169 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
170 | 170 | $modSettings['search_simple_fulltext'] = true; |
171 | 171 | |
172 | 172 | if ($query_params['id_search']) |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | if (!empty($modSettings['search_simple_fulltext'])) |
211 | 211 | { |
212 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
212 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
213 | 213 | { |
214 | 214 | $language_ftx = $smcFunc['db_search_language'](); |
215 | 215 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // remove any indexed words that are used in the complex body search terms |
228 | 228 | $words['indexed_words'] = array_diff($words['indexed_words'], $words['complex_words']); |
229 | 229 | |
230 | - if($smcFunc['db_title'] == "PostgreSQL"){ |
|
230 | + if ($smcFunc['db_title'] == "PostgreSQL") { |
|
231 | 231 | $row = 0; |
232 | 232 | foreach ($words['indexed_words'] as $fulltextWord) { |
233 | 233 | $query_params['boolean_match'] .= ($row <> 0 ? '&' : ''); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | // if we have bool terms to search, add them in |
245 | 245 | if ($query_params['boolean_match']) { |
246 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
246 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
247 | 247 | { |
248 | 248 | $language_ftx = $smcFunc['db_search_language'](); |
249 | 249 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | - $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( ' |
|
259 | + $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? (' |
|
260 | 260 | INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . ' |
261 | 261 | (' . implode(', ', array_keys($query_select)) . ')') : '') . ' |
262 | 262 | SELECT ' . implode(', ', $query_select) . ' |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | * @version 2.1 Beta 4 |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('SMF')) |
|
14 | +if (!defined('SMF')) { |
|
15 | 15 | die('No direct access...'); |
16 | +} |
|
16 | 17 | |
17 | 18 | /** |
18 | 19 | * Class fulltext_search |
@@ -98,8 +99,9 @@ discard block |
||
98 | 99 | $smcFunc['db_free_result']($request); |
99 | 100 | } |
100 | 101 | // 4 is the MySQL default... |
101 | - else |
|
102 | - $min_word_length = 4; |
|
102 | + else { |
|
103 | + $min_word_length = 4; |
|
104 | + } |
|
103 | 105 | |
104 | 106 | return $min_word_length; |
105 | 107 | } |
@@ -138,8 +140,7 @@ discard block |
||
138 | 140 | $wordsSearch['words'][] = trim($word, "/*- "); |
139 | 141 | $wordsSearch['complex_words'][] = count($subwords) === 1 ? $word : '"' . $word . '"'; |
140 | 142 | } |
141 | - } |
|
142 | - elseif ($smcFunc['strlen'](trim($word, "/*- ")) < $this->min_word_length) |
|
143 | + } elseif ($smcFunc['strlen'](trim($word, "/*- ")) < $this->min_word_length) |
|
143 | 144 | { |
144 | 145 | // short words have feelings too |
145 | 146 | $wordsSearch['words'][] = trim($word, "/*- "); |
@@ -149,8 +150,9 @@ discard block |
||
149 | 150 | |
150 | 151 | $fulltextWord = count($subwords) === 1 ? $word : '"' . $word . '"'; |
151 | 152 | $wordsSearch['indexed_words'][] = $fulltextWord; |
152 | - if ($isExcluded) |
|
153 | - $wordsExclude[] = $fulltextWord; |
|
153 | + if ($isExcluded) { |
|
154 | + $wordsExclude[] = $fulltextWord; |
|
155 | + } |
|
154 | 156 | } |
155 | 157 | |
156 | 158 | /** |
@@ -166,44 +168,54 @@ discard block |
||
166 | 168 | $query_where = array(); |
167 | 169 | $query_params = $search_data['params']; |
168 | 170 | |
169 | - if( $smcFunc['db_title'] == "PostgreSQL") |
|
170 | - $modSettings['search_simple_fulltext'] = true; |
|
171 | + if( $smcFunc['db_title'] == "PostgreSQL") { |
|
172 | + $modSettings['search_simple_fulltext'] = true; |
|
173 | + } |
|
171 | 174 | |
172 | - if ($query_params['id_search']) |
|
173 | - $query_select['id_search'] = '{int:id_search}'; |
|
175 | + if ($query_params['id_search']) { |
|
176 | + $query_select['id_search'] = '{int:id_search}'; |
|
177 | + } |
|
174 | 178 | |
175 | 179 | $count = 0; |
176 | - if (empty($modSettings['search_simple_fulltext'])) |
|
177 | - foreach ($words['words'] as $regularWord) |
|
180 | + if (empty($modSettings['search_simple_fulltext'])) { |
|
181 | + foreach ($words['words'] as $regularWord) |
|
178 | 182 | { |
179 | 183 | $query_where[] = 'm.body' . (in_array($regularWord, $query_params['excluded_words']) ? ' NOT' : '') . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : 'RLIKE') . '{string:complex_body_' . $count . '}'; |
184 | + } |
|
180 | 185 | $query_params['complex_body_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($regularWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $regularWord), '\\\'') . '[[:>:]]'; |
181 | 186 | } |
182 | 187 | |
183 | - if ($query_params['user_query']) |
|
184 | - $query_where[] = '{raw:user_query}'; |
|
185 | - if ($query_params['board_query']) |
|
186 | - $query_where[] = 'm.id_board {raw:board_query}'; |
|
188 | + if ($query_params['user_query']) { |
|
189 | + $query_where[] = '{raw:user_query}'; |
|
190 | + } |
|
191 | + if ($query_params['board_query']) { |
|
192 | + $query_where[] = 'm.id_board {raw:board_query}'; |
|
193 | + } |
|
187 | 194 | |
188 | - if ($query_params['topic']) |
|
189 | - $query_where[] = 'm.id_topic = {int:topic}'; |
|
190 | - if ($query_params['min_msg_id']) |
|
191 | - $query_where[] = 'm.id_msg >= {int:min_msg_id}'; |
|
192 | - if ($query_params['max_msg_id']) |
|
193 | - $query_where[] = 'm.id_msg <= {int:max_msg_id}'; |
|
195 | + if ($query_params['topic']) { |
|
196 | + $query_where[] = 'm.id_topic = {int:topic}'; |
|
197 | + } |
|
198 | + if ($query_params['min_msg_id']) { |
|
199 | + $query_where[] = 'm.id_msg >= {int:min_msg_id}'; |
|
200 | + } |
|
201 | + if ($query_params['max_msg_id']) { |
|
202 | + $query_where[] = 'm.id_msg <= {int:max_msg_id}'; |
|
203 | + } |
|
194 | 204 | |
195 | 205 | $count = 0; |
196 | - if (!empty($query_params['excluded_phrases']) && empty($modSettings['search_force_index'])) |
|
197 | - foreach ($query_params['excluded_phrases'] as $phrase) |
|
206 | + if (!empty($query_params['excluded_phrases']) && empty($modSettings['search_force_index'])) { |
|
207 | + foreach ($query_params['excluded_phrases'] as $phrase) |
|
198 | 208 | { |
199 | 209 | $query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : 'RLIKE') . '{string:exclude_subject_phrase_' . $count . '}'; |
210 | + } |
|
200 | 211 | $query_params['exclude_subject_phrase_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]'; |
201 | 212 | } |
202 | 213 | $count = 0; |
203 | - if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index'])) |
|
204 | - foreach ($query_params['excluded_subject_words'] as $excludedWord) |
|
214 | + if (!empty($query_params['excluded_subject_words']) && empty($modSettings['search_force_index'])) { |
|
215 | + foreach ($query_params['excluded_subject_words'] as $excludedWord) |
|
205 | 216 | { |
206 | 217 | $query_where[] = 'subject NOT ' . (empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? ' LIKE ' : 'RLIKE') . '{string:exclude_subject_words_' . $count . '}'; |
218 | + } |
|
207 | 219 | $query_params['exclude_subject_words_' . $count++] = empty($modSettings['search_match_words']) || $search_data['no_regexp'] ? '%' . strtr($excludedWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $excludedWord), '\\\'') . '[[:>:]]'; |
208 | 220 | } |
209 | 221 | |
@@ -215,12 +227,11 @@ discard block |
||
215 | 227 | |
216 | 228 | $query_where[] = 'to_tsvector({string:language_ftx},body) @@ to_tsquery({string:language_ftx},{string:body_match})'; |
217 | 229 | $query_params['language_ftx'] = $language_ftx; |
230 | + } else { |
|
231 | + $query_where[] = 'MATCH (body) AGAINST ({string:body_match})'; |
|
218 | 232 | } |
219 | - else |
|
220 | - $query_where[] = 'MATCH (body) AGAINST ({string:body_match})'; |
|
221 | 233 | $query_params['body_match'] = implode(' ', array_diff($words['indexed_words'], $query_params['excluded_index_words'])); |
222 | - } |
|
223 | - else |
|
234 | + } else |
|
224 | 235 | { |
225 | 236 | $query_params['boolean_match'] = ''; |
226 | 237 | |
@@ -234,10 +245,10 @@ discard block |
||
234 | 245 | $query_params['boolean_match'] .= (in_array($fulltextWord, $query_params['excluded_index_words']) ? '!' : '') . $fulltextWord . ' '; |
235 | 246 | $row++; |
236 | 247 | } |
237 | - } |
|
238 | - else |
|
239 | - foreach ($words['indexed_words'] as $fulltextWord) |
|
248 | + } else { |
|
249 | + foreach ($words['indexed_words'] as $fulltextWord) |
|
240 | 250 | $query_params['boolean_match'] .= (in_array($fulltextWord, $query_params['excluded_index_words']) ? '-' : '+') . $fulltextWord . ' '; |
251 | + } |
|
241 | 252 | |
242 | 253 | $query_params['boolean_match'] = substr($query_params['boolean_match'], 0, -1); |
243 | 254 | |
@@ -249,9 +260,9 @@ discard block |
||
249 | 260 | |
250 | 261 | $query_where[] = 'to_tsvector({string:language_ftx},body) @@ to_tsquery({string:language_ftx},{string:boolean_match})'; |
251 | 262 | $query_params['language_ftx'] = $language_ftx; |
263 | + } else { |
|
264 | + $query_where[] = 'MATCH (body) AGAINST ({string:boolean_match} IN BOOLEAN MODE)'; |
|
252 | 265 | } |
253 | - else |
|
254 | - $query_where[] = 'MATCH (body) AGAINST ({string:boolean_match} IN BOOLEAN MODE)'; |
|
255 | 266 | } |
256 | 267 | |
257 | 268 | } |
@@ -116,9 +116,10 @@ discard block |
||
116 | 116 | <h3 class="catbg">', $txt['attachment_transfer'], '</h3> |
117 | 117 | </div>'; |
118 | 118 | |
119 | - if (!empty($context['results'])) |
|
120 | - echo ' |
|
119 | + if (!empty($context['results'])) { |
|
120 | + echo ' |
|
121 | 121 | <div class="noticebox">', $context['results'], '</div>'; |
122 | + } |
|
122 | 123 | |
123 | 124 | echo ' |
124 | 125 | <div class="windowbg2 noup"> |
@@ -129,9 +130,10 @@ discard block |
||
129 | 130 | <dd><select name="from"> |
130 | 131 | <option value="0">', $txt['attachment_transfer_select'], '</option>'; |
131 | 132 | |
132 | - foreach ($context['attach_dirs'] as $id => $dir) |
|
133 | - echo ' |
|
133 | + foreach ($context['attach_dirs'] as $id => $dir) { |
|
134 | + echo ' |
|
134 | 135 | <option value="', $id, '">', $dir, '</option>'; |
136 | + } |
|
135 | 137 | echo ' |
136 | 138 | </select></dd> |
137 | 139 | <dt>', $txt['attachment_transfer_auto'], '</dt> |
@@ -139,13 +141,14 @@ discard block |
||
139 | 141 | <option value="0">', $txt['attachment_transfer_auto_select'], '</option> |
140 | 142 | <option value="-1">', $txt['attachment_transfer_forum_root'], '</option>'; |
141 | 143 | |
142 | - if (!empty($context['base_dirs'])) |
|
143 | - foreach ($context['base_dirs'] as $id => $dir) |
|
144 | + if (!empty($context['base_dirs'])) { |
|
145 | + foreach ($context['base_dirs'] as $id => $dir) |
|
144 | 146 | echo ' |
145 | 147 | <option value="', $id, '">', $dir, '</option>'; |
146 | - else |
|
147 | - echo ' |
|
148 | + } else { |
|
149 | + echo ' |
|
148 | 150 | <option value="0" disabled>', $txt['attachment_transfer_no_base'], '</option>'; |
151 | + } |
|
149 | 152 | |
150 | 153 | echo ' |
151 | 154 | </select></dd> |
@@ -153,16 +156,18 @@ discard block |
||
153 | 156 | <dd><select name="to"> |
154 | 157 | <option value="0">', $txt['attachment_transfer_select'], '</option>'; |
155 | 158 | |
156 | - foreach ($context['attach_dirs'] as $id => $dir) |
|
157 | - echo ' |
|
159 | + foreach ($context['attach_dirs'] as $id => $dir) { |
|
160 | + echo ' |
|
158 | 161 | <option value="', $id, '">', $dir, '</option>'; |
162 | + } |
|
159 | 163 | echo ' |
160 | 164 | </select></dd>'; |
161 | 165 | |
162 | - if (!empty($modSettings['attachmentDirFileLimit'])) |
|
163 | - echo ' |
|
166 | + if (!empty($modSettings['attachmentDirFileLimit'])) { |
|
167 | + echo ' |
|
164 | 168 | <dt>', $txt['attachment_transfer_empty'], '</dt> |
165 | 169 | <dd><input type="checkbox" name="empty_it"', $context['checked'] ? ' checked' : '', '></dd>'; |
170 | + } |
|
166 | 171 | echo ' |
167 | 172 | </dl> |
168 | 173 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -238,10 +243,11 @@ discard block |
||
238 | 243 | // Loop through each error reporting the status |
239 | 244 | foreach ($context['repair_errors'] as $error => $number) |
240 | 245 | { |
241 | - if (!empty($number)) |
|
242 | - echo ' |
|
246 | + if (!empty($number)) { |
|
247 | + echo ' |
|
243 | 248 | <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '"> |
244 | 249 | <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br>'; |
250 | + } |
|
245 | 251 | } |
246 | 252 | |
247 | 253 | echo ' <br> |
@@ -18,11 +18,12 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl, $modSettings; |
19 | 19 | |
20 | 20 | // If maintenance has finished tell the user. |
21 | - if (!empty($context['maintenance_finished'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['maintenance_finished'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox"> |
24 | 24 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
25 | 25 | </div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | echo ' |
28 | 29 | <div id="manage_maintenance"> |
@@ -107,11 +108,12 @@ discard block |
||
107 | 108 | <div id="manage_maintenance">'; |
108 | 109 | |
109 | 110 | // If maintenance has finished tell the user. |
110 | - if (!empty($context['maintenance_finished'])) |
|
111 | - echo ' |
|
111 | + if (!empty($context['maintenance_finished'])) { |
|
112 | + echo ' |
|
112 | 113 | <div class="infobox"> |
113 | 114 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
114 | 115 | </div>'; |
116 | + } |
|
115 | 117 | |
116 | 118 | echo ' |
117 | 119 | <div class="cat_bar"> |
@@ -238,11 +240,12 @@ discard block |
||
238 | 240 | <div id="manage_maintenance">'; |
239 | 241 | |
240 | 242 | // If maintenance has finished tell the user. |
241 | - if (!empty($context['maintenance_finished'])) |
|
242 | - echo ' |
|
243 | + if (!empty($context['maintenance_finished'])) { |
|
244 | + echo ' |
|
243 | 245 | <div class="infobox"> |
244 | 246 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
245 | 247 | </div>'; |
248 | + } |
|
246 | 249 | |
247 | 250 | echo ' |
248 | 251 | <div class="cat_bar"> |
@@ -300,9 +303,10 @@ discard block |
||
300 | 303 | <p><a href="#membersLink" onclick="swapMembers();"><img src="', $settings['images_url'], '/selected.png" alt="+" id="membersIcon"></a> <a href="#membersLink" onclick="swapMembers();" id="membersText" style="font-weight: bold;">', $txt['maintain_members_all'], '</a></p> |
301 | 304 | <div style="display: none; padding: 3px" id="membersPanel">'; |
302 | 305 | |
303 | - foreach ($context['membergroups'] as $group) |
|
304 | - echo ' |
|
306 | + foreach ($context['membergroups'] as $group) { |
|
307 | + echo ' |
|
305 | 308 | <label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked> ', $group['name'], '</label><br>'; |
309 | + } |
|
306 | 310 | |
307 | 311 | echo ' |
308 | 312 | </div> |
@@ -346,11 +350,12 @@ discard block |
||
346 | 350 | global $scripturl, $txt, $context, $settings, $modSettings; |
347 | 351 | |
348 | 352 | // If maintenance has finished tell the user. |
349 | - if (!empty($context['maintenance_finished'])) |
|
350 | - echo ' |
|
353 | + if (!empty($context['maintenance_finished'])) { |
|
354 | + echo ' |
|
351 | 355 | <div class="infobox"> |
352 | 356 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
353 | 357 | </div>'; |
358 | + } |
|
354 | 359 | |
355 | 360 | // Bit of javascript for showing which boards to prune in an otherwise hidden list. |
356 | 361 | echo ' |
@@ -418,19 +423,21 @@ discard block |
||
418 | 423 | <ul>'; |
419 | 424 | |
420 | 425 | // Display a checkbox with every board. |
421 | - foreach ($category['boards'] as $board) |
|
422 | - echo ' |
|
426 | + foreach ($category['boards'] as $board) { |
|
427 | + echo ' |
|
423 | 428 | <li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"><label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked>', $board['name'], '</label></li>'; |
429 | + } |
|
424 | 430 | |
425 | 431 | echo ' |
426 | 432 | </ul> |
427 | 433 | </fieldset>'; |
428 | 434 | |
429 | 435 | // Increase $i, and check if we're at the middle yet. |
430 | - if (++$i == $middle) |
|
431 | - echo ' |
|
436 | + if (++$i == $middle) { |
|
437 | + echo ' |
|
432 | 438 | </div> |
433 | 439 | <div class="floatright" style="width: 49%;">'; |
440 | + } |
|
434 | 441 | } |
435 | 442 | |
436 | 443 | echo ' |
@@ -469,9 +476,10 @@ discard block |
||
469 | 476 | echo ' |
470 | 477 | <optgroup label="', $category['name'], '">'; |
471 | 478 | |
472 | - foreach ($category['boards'] as $board) |
|
473 | - echo ' |
|
479 | + foreach ($category['boards'] as $board) { |
|
480 | + echo ' |
|
474 | 481 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
482 | + } |
|
475 | 483 | |
476 | 484 | echo ' |
477 | 485 | </optgroup>'; |
@@ -489,9 +497,10 @@ discard block |
||
489 | 497 | echo ' |
490 | 498 | <optgroup label="', $category['name'], '">'; |
491 | 499 | |
492 | - foreach ($category['boards'] as $board) |
|
493 | - echo ' |
|
500 | + foreach ($category['boards'] as $board) { |
|
501 | + echo ' |
|
494 | 502 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
503 | + } |
|
495 | 504 | |
496 | 505 | echo ' |
497 | 506 | </optgroup>'; |
@@ -531,9 +540,10 @@ discard block |
||
531 | 540 | ', $txt['database_optimize_attempt'], '<br>'; |
532 | 541 | |
533 | 542 | // List each table being optimized... |
534 | - foreach ($context['optimized_tables'] as $table) |
|
535 | - echo ' |
|
543 | + foreach ($context['optimized_tables'] as $table) { |
|
544 | + echo ' |
|
536 | 545 | ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>'; |
546 | + } |
|
537 | 547 | |
538 | 548 | // How did we go? |
539 | 549 | echo ' |
@@ -590,13 +600,14 @@ discard block |
||
590 | 600 | ', implode('</li><li>', $context['exceeding_messages']), ' |
591 | 601 | </li> |
592 | 602 | </ul>'; |
593 | - if (!empty($context['exceeding_messages_morethan'])) |
|
594 | - echo ' |
|
603 | + if (!empty($context['exceeding_messages_morethan'])) { |
|
604 | + echo ' |
|
595 | 605 | <p>', $context['exceeding_messages_morethan'], '</p>'; |
596 | - } |
|
597 | - else |
|
598 | - echo ' |
|
606 | + } |
|
607 | + } else { |
|
608 | + echo ' |
|
599 | 609 | <p class="infobox">', $txt['convert_to_text'], '</p>'; |
610 | + } |
|
600 | 611 | |
601 | 612 | echo ' |
602 | 613 | <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '"> |
@@ -29,9 +29,10 @@ discard block |
||
29 | 29 | // Go through each type of report they can run. |
30 | 30 | foreach ($context['report_types'] as $type) |
31 | 31 | { |
32 | - if (isset($type['description'])) |
|
33 | - echo ' |
|
32 | + if (isset($type['description'])) { |
|
33 | + echo ' |
|
34 | 34 | <dt>', $type['description'], '</dt>'; |
35 | + } |
|
35 | 36 | echo ' |
36 | 37 | <dd> |
37 | 38 | <input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked' : '', '> |
@@ -61,8 +62,9 @@ discard block |
||
61 | 62 | </div> |
62 | 63 | <div id="report_buttons">'; |
63 | 64 | |
64 | - if (!empty($context['report_buttons'])) |
|
65 | - template_button_strip($context['report_buttons'], 'right'); |
|
65 | + if (!empty($context['report_buttons'])) { |
|
66 | + template_button_strip($context['report_buttons'], 'right'); |
|
67 | + } |
|
66 | 68 | |
67 | 69 | echo ' |
68 | 70 | </div>'; |
@@ -73,25 +75,27 @@ discard block |
||
73 | 75 | echo ' |
74 | 76 | <table class="table_grid report_results">'; |
75 | 77 | |
76 | - if (!empty($table['title'])) |
|
77 | - echo ' |
|
78 | + if (!empty($table['title'])) { |
|
79 | + echo ' |
|
78 | 80 | <thead> |
79 | 81 | <tr class="title_bar"> |
80 | 82 | <th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th> |
81 | 83 | </tr> |
82 | 84 | </thead> |
83 | 85 | <tbody>'; |
86 | + } |
|
84 | 87 | |
85 | 88 | // Now do each row! |
86 | 89 | $row_number = 0; |
87 | 90 | foreach ($table['data'] as $row) |
88 | 91 | { |
89 | - if ($row_number == 0 && !empty($table['shading']['top'])) |
|
90 | - echo ' |
|
92 | + if ($row_number == 0 && !empty($table['shading']['top'])) { |
|
93 | + echo ' |
|
91 | 94 | <tr class="windowbg table_caption">'; |
92 | - else |
|
93 | - echo ' |
|
95 | + } else { |
|
96 | + echo ' |
|
94 | 97 | <tr class="', !empty($row[0]['separator']) ? 'title_bar' : 'windowbg', '">'; |
98 | + } |
|
95 | 99 | |
96 | 100 | // Now do each column. |
97 | 101 | $column_number = 0; |
@@ -109,16 +113,17 @@ discard block |
||
109 | 113 | } |
110 | 114 | |
111 | 115 | // Shaded? |
112 | - if ($column_number == 0 && !empty($table['shading']['left'])) |
|
113 | - echo ' |
|
116 | + if ($column_number == 0 && !empty($table['shading']['left'])) { |
|
117 | + echo ' |
|
114 | 118 | <td class="table_caption ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '> |
115 | 119 | ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), ' |
116 | 120 | </td>'; |
117 | - else |
|
118 | - echo ' |
|
121 | + } else { |
|
122 | + echo ' |
|
119 | 123 | <td class="smalltext centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '> |
120 | 124 | ', $data['v'], ' |
121 | 125 | </td>'; |
126 | + } |
|
122 | 127 | |
123 | 128 | $column_number++; |
124 | 129 | } |
@@ -167,24 +172,26 @@ discard block |
||
167 | 172 | <div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width: ' . $table['max_width'] . 'px;' : '', '"> |
168 | 173 | <table class="bordercolor">'; |
169 | 174 | |
170 | - if (!empty($table['title'])) |
|
171 | - echo ' |
|
175 | + if (!empty($table['title'])) { |
|
176 | + echo ' |
|
172 | 177 | <tr class="title_bar"> |
173 | 178 | <td colspan="', $table['column_count'], '"> |
174 | 179 | ', $table['title'], ' |
175 | 180 | </td> |
176 | 181 | </tr>'; |
182 | + } |
|
177 | 183 | |
178 | 184 | // Now do each row! |
179 | 185 | $row_number = 0; |
180 | 186 | foreach ($table['data'] as $row) |
181 | 187 | { |
182 | - if ($row_number == 0 && !empty($table['shading']['top'])) |
|
183 | - echo ' |
|
188 | + if ($row_number == 0 && !empty($table['shading']['top'])) { |
|
189 | + echo ' |
|
184 | 190 | <tr class="titlebg">'; |
185 | - else |
|
186 | - echo ' |
|
191 | + } else { |
|
192 | + echo ' |
|
187 | 193 | <tr class="windowbg">'; |
194 | + } |
|
188 | 195 | |
189 | 196 | // Now do each column!! |
190 | 197 | $column_number = 0; |
@@ -201,16 +208,17 @@ discard block |
||
201 | 208 | } |
202 | 209 | |
203 | 210 | // Shaded? |
204 | - if ($column_number == 0 && !empty($table['shading']['left'])) |
|
205 | - echo ' |
|
211 | + if ($column_number == 0 && !empty($table['shading']['left'])) { |
|
212 | + echo ' |
|
206 | 213 | <td class="titlebg ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '> |
207 | 214 | ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), ' |
208 | 215 | </td>'; |
209 | - else |
|
210 | - echo ' |
|
216 | + } else { |
|
217 | + echo ' |
|
211 | 218 | <td class="centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '> |
212 | 219 | ', $data['v'], ' |
213 | 220 | </td>'; |
221 | + } |
|
214 | 222 | |
215 | 223 | $column_number++; |
216 | 224 | } |
@@ -26,9 +26,10 @@ discard block |
||
26 | 26 | </h3> |
27 | 27 | </div>'; |
28 | 28 | |
29 | - if ($context['ban']['is_new']) |
|
30 | - echo ' |
|
29 | + if ($context['ban']['is_new']) { |
|
30 | + echo ' |
|
31 | 31 | <div class="information noup">', $txt['ban_add_notes'], '</div>'; |
32 | + } |
|
32 | 33 | |
33 | 34 | // If there were errors creating the ban, show them. |
34 | 35 | if (!empty($context['error_messages'])) |
@@ -38,9 +39,10 @@ discard block |
||
38 | 39 | <strong>', $txt['ban_errors_detected'], '</strong> |
39 | 40 | <ul>'; |
40 | 41 | |
41 | - foreach ($context['error_messages'] as $error) |
|
42 | - echo ' |
|
42 | + foreach ($context['error_messages'] as $error) { |
|
43 | + echo ' |
|
43 | 44 | <li class="error">', $error, '</li>'; |
45 | + } |
|
44 | 46 | |
45 | 47 | echo ' |
46 | 48 | </ul> |
@@ -57,8 +59,8 @@ discard block |
||
57 | 59 | <input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60"> |
58 | 60 | </dd>'; |
59 | 61 | |
60 | - if (isset($context['ban']['reason'])) |
|
61 | - echo ' |
|
62 | + if (isset($context['ban']['reason'])) { |
|
63 | + echo ' |
|
62 | 64 | <dt> |
63 | 65 | <strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br> |
64 | 66 | <span class="smalltext">', $txt['ban_reason_desc'], '</span> |
@@ -66,9 +68,10 @@ discard block |
||
66 | 68 | <dd> |
67 | 69 | <textarea name="reason" id="reason" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['reason'], '</textarea> |
68 | 70 | </dd>'; |
71 | + } |
|
69 | 72 | |
70 | - if (isset($context['ban']['notes'])) |
|
71 | - echo ' |
|
73 | + if (isset($context['ban']['notes'])) { |
|
74 | + echo ' |
|
72 | 75 | <dt> |
73 | 76 | <strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br> |
74 | 77 | <span class="smalltext">', $txt['ban_notes_desc'], '</span> |
@@ -76,6 +79,7 @@ discard block |
||
76 | 79 | <dd> |
77 | 80 | <textarea name="notes" id="ban_notes" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['notes'], '</textarea> |
78 | 81 | </dd>'; |
82 | + } |
|
79 | 83 | |
80 | 84 | echo ' |
81 | 85 | </dl> |
@@ -115,8 +119,8 @@ discard block |
||
115 | 119 | <input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
116 | 120 | </dd>'; |
117 | 121 | |
118 | - if (empty($modSettings['disableHostnameLookup'])) |
|
119 | - echo ' |
|
122 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
123 | + echo ' |
|
120 | 124 | <dt> |
121 | 125 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '> |
122 | 126 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -124,6 +128,7 @@ discard block |
||
124 | 128 | <dd> |
125 | 129 | <input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
126 | 130 | </dd>'; |
131 | + } |
|
127 | 132 | |
128 | 133 | echo ' |
129 | 134 | <dt> |
@@ -153,14 +158,15 @@ discard block |
||
153 | 158 | <dl class="settings">'; |
154 | 159 | |
155 | 160 | $count = 0; |
156 | - foreach ($ban_ips as $ip) |
|
157 | - echo ' |
|
161 | + foreach ($ban_ips as $ip) { |
|
162 | + echo ' |
|
158 | 163 | <dt> |
159 | 164 | <input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '"> |
160 | 165 | </dt> |
161 | 166 | <dd> |
162 | 167 | <label for="suggestions_', $key, '_', $count++, '">', $ip, '</label> |
163 | 168 | </dd>'; |
169 | + } |
|
164 | 170 | |
165 | 171 | echo ' |
166 | 172 | </dl>'; |
@@ -202,8 +208,8 @@ discard block |
||
202 | 208 | addLoadEvent(fUpdateStatus);'; |
203 | 209 | |
204 | 210 | // Auto suggest only needed for adding new bans, not editing |
205 | - if ($context['ban']['is_new'] && empty($_REQUEST['u'])) |
|
206 | - echo ' |
|
211 | + if ($context['ban']['is_new'] && empty($_REQUEST['u'])) { |
|
212 | + echo ' |
|
207 | 213 | var oAddMemberSuggest = new smc_AutoSuggest({ |
208 | 214 | sSelf: \'oAddMemberSuggest\', |
209 | 215 | sSessionId: smf_session_id, |
@@ -221,6 +227,7 @@ discard block |
||
221 | 227 | return true; |
222 | 228 | } |
223 | 229 | oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');'; |
230 | + } |
|
224 | 231 | |
225 | 232 | echo ' |
226 | 233 | function confirmBan(aForm) |
@@ -268,8 +275,8 @@ discard block |
||
268 | 275 | <input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
269 | 276 | </dd>'; |
270 | 277 | |
271 | - if (empty($modSettings['disableHostnameLookup'])) |
|
272 | - echo ' |
|
278 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
279 | + echo ' |
|
273 | 280 | <dt> |
274 | 281 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '> |
275 | 282 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -277,6 +284,7 @@ discard block |
||
277 | 284 | <dd> |
278 | 285 | <input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
279 | 286 | </dd>'; |
287 | + } |
|
280 | 288 | |
281 | 289 | echo ' |
282 | 290 | <dt> |
@@ -18,9 +18,10 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl; |
19 | 19 | |
20 | 20 | // Are we done sending the newsletter? |
21 | - if (!empty($context['newsletter_sent'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['newsletter_sent'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
24 | + } |
|
24 | 25 | |
25 | 26 | echo ' |
26 | 27 | <div id="admincenter"> |
@@ -39,9 +40,10 @@ discard block |
||
39 | 40 | </dt> |
40 | 41 | <dd>'; |
41 | 42 | |
42 | - foreach ($context['groups'] as $group) |
|
43 | - echo ' |
|
43 | + foreach ($context['groups'] as $group) { |
|
44 | + echo ' |
|
44 | 45 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
46 | + } |
|
45 | 47 | |
46 | 48 | echo ' |
47 | 49 | <br> |
@@ -82,9 +84,10 @@ discard block |
||
82 | 84 | </dt> |
83 | 85 | <dd>'; |
84 | 86 | |
85 | - foreach ($context['groups'] as $group) |
|
86 | - echo ' |
|
87 | + foreach ($context['groups'] as $group) { |
|
88 | + echo ' |
|
87 | 89 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
90 | + } |
|
88 | 91 | |
89 | 92 | echo ' |
90 | 93 | <br> |
@@ -228,9 +231,10 @@ discard block |
||
228 | 231 | <div id="bbcBox_message"></div>'; |
229 | 232 | |
230 | 233 | // What about smileys? |
231 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
232 | - echo ' |
|
234 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
235 | + echo ' |
|
233 | 236 | <div id="smileyBox_message"></div>'; |
237 | + } |
|
234 | 238 | |
235 | 239 | // Show BBC buttons, smileys and textbox. |
236 | 240 | echo ' |
@@ -251,9 +255,10 @@ discard block |
||
251 | 255 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
252 | 256 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
253 | 257 | |
254 | - foreach ($context['recipients'] as $key => $values) |
|
255 | - echo ' |
|
258 | + foreach ($context['recipients'] as $key => $values) { |
|
259 | + echo ' |
|
256 | 260 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
261 | + } |
|
257 | 262 | |
258 | 263 | echo ' |
259 | 264 | <script>'; |
@@ -408,9 +413,10 @@ discard block |
||
408 | 413 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
409 | 414 | |
410 | 415 | // All the things we must remember! |
411 | - foreach ($context['recipients'] as $key => $values) |
|
412 | - echo ' |
|
416 | + foreach ($context['recipients'] as $key => $values) { |
|
417 | + echo ' |
|
413 | 418 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
419 | + } |
|
414 | 420 | |
415 | 421 | echo ' |
416 | 422 | </div> |
@@ -443,9 +449,10 @@ discard block |
||
443 | 449 | { |
444 | 450 | global $context, $txt; |
445 | 451 | |
446 | - if (!empty($context['saved_successful'])) |
|
447 | - echo ' |
|
452 | + if (!empty($context['saved_successful'])) { |
|
453 | + echo ' |
|
448 | 454 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
455 | + } |
|
449 | 456 | |
450 | 457 | template_show_list('news_lists'); |
451 | 458 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | </thead> |
149 | 149 | <tbody>'; |
150 | 150 | |
151 | - foreach ($context['membergroups'] as $membergroup) |
|
152 | - echo ' |
|
151 | + foreach ($context['membergroups'] as $membergroup) { |
|
152 | + echo ' |
|
153 | 153 | <tr class="windowbg"> |
154 | 154 | <td>', $membergroup['name'], '</td> |
155 | 155 | <td class="centercol"> |
@@ -159,6 +159,7 @@ discard block |
||
159 | 159 | ', $membergroup['can_be_additional'] ? '<input type="checkbox" name="membergroups[2][]" value="' . $membergroup['id'] . '" checked>' : '', ' |
160 | 160 | </td> |
161 | 161 | </tr>'; |
162 | + } |
|
162 | 163 | |
163 | 164 | echo ' |
164 | 165 | <tr class="windowbg"> |
@@ -185,8 +186,8 @@ discard block |
||
185 | 186 | </thead> |
186 | 187 | <tbody>'; |
187 | 188 | |
188 | - foreach ($context['postgroups'] as $postgroup) |
|
189 | - echo ' |
|
189 | + foreach ($context['postgroups'] as $postgroup) { |
|
190 | + echo ' |
|
190 | 191 | <tr class="windowbg"> |
191 | 192 | <td> |
192 | 193 | ', $postgroup['name'], ' |
@@ -195,6 +196,7 @@ discard block |
||
195 | 196 | <input type="checkbox" name="postgroups[]" value="', $postgroup['id'], '" checked> |
196 | 197 | </td> |
197 | 198 | </tr>'; |
199 | + } |
|
198 | 200 | |
199 | 201 | echo ' |
200 | 202 | <tr class="windowbg"> |
@@ -54,8 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | // Prepare the comments... |
56 | 56 | $comments = array(); |
57 | - foreach ($report['comments'] as $comment) |
|
58 | - $comments[$comment['member']['id']] = $comment['member']['link']; |
|
57 | + foreach ($report['comments'] as $comment) { |
|
58 | + $comments[$comment['member']['id']] = $comment['member']['link']; |
|
59 | + } |
|
59 | 60 | |
60 | 61 | echo ' |
61 | 62 | ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), ' |
@@ -69,18 +70,21 @@ discard block |
||
69 | 70 | <li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>'; |
70 | 71 | |
71 | 72 | // Delete message button. |
72 | - if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) |
|
73 | - echo ' |
|
73 | + if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))) { |
|
74 | + echo ' |
|
74 | 75 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'], '.0;msg=', $report['topic']['id_msg'], ';modcenter;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['mc_reportedp_delete_confirm'], '" class="you_sure">', $delete_button, '</a></li>'; |
76 | + } |
|
75 | 77 | |
76 | 78 | // Ban this user button. |
77 | - if (!$report['closed'] && !empty($context['report_manage_bans'])) |
|
78 | - echo ' |
|
79 | + if (!$report['closed'] && !empty($context['report_manage_bans'])) { |
|
80 | + echo ' |
|
79 | 81 | <li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']), ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>'; |
82 | + } |
|
80 | 83 | |
81 | - if (!$context['view_closed']) |
|
82 | - echo ' |
|
84 | + if (!$context['view_closed']) { |
|
85 | + echo ' |
|
83 | 86 | <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>'; |
87 | + } |
|
84 | 88 | |
85 | 89 | echo ' |
86 | 90 | </ul> |
@@ -88,11 +92,12 @@ discard block |
||
88 | 92 | } |
89 | 93 | |
90 | 94 | // Were none found? |
91 | - if (empty($context['reports'])) |
|
92 | - echo ' |
|
95 | + if (empty($context['reports'])) { |
|
96 | + echo ' |
|
93 | 97 | <div class="windowbg2"> |
94 | 98 | <p class="centertext">', $txt['mc_reportedp_none_found'], '</p> |
95 | 99 | </div>'; |
100 | + } |
|
96 | 101 | |
97 | 102 | echo ' |
98 | 103 | <div class="pagesection"> |
@@ -125,18 +130,20 @@ discard block |
||
125 | 130 | <div class="modbox"> |
126 | 131 | <ul>'; |
127 | 132 | |
128 | - foreach ($context['reported_posts'] as $report) |
|
129 | - echo ' |
|
133 | + foreach ($context['reported_posts'] as $report) { |
|
134 | + echo ' |
|
130 | 135 | <li class="smalltext"> |
131 | 136 | <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], ' |
132 | 137 | </li>'; |
138 | + } |
|
133 | 139 | |
134 | 140 | // Don't have any watched users right now? |
135 | - if (empty($context['reported_posts'])) |
|
136 | - echo ' |
|
141 | + if (empty($context['reported_posts'])) { |
|
142 | + echo ' |
|
137 | 143 | <li> |
138 | 144 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
139 | 145 | </li>'; |
146 | + } |
|
140 | 147 | |
141 | 148 | echo ' |
142 | 149 | </ul> |
@@ -226,12 +233,13 @@ discard block |
||
226 | 233 | <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3> |
227 | 234 | </div>'; |
228 | 235 | |
229 | - foreach ($context['report']['comments'] as $comment) |
|
230 | - echo ' |
|
236 | + foreach ($context['report']['comments'] as $comment) { |
|
237 | + echo ' |
|
231 | 238 | <div class="windowbg"> |
232 | 239 | <p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p> |
233 | 240 | <p>', $comment['message'], '</p> |
234 | 241 | </div>'; |
242 | + } |
|
235 | 243 | |
236 | 244 | echo ' |
237 | 245 | <br> |
@@ -240,11 +248,12 @@ discard block |
||
240 | 248 | </div> |
241 | 249 | <div>'; |
242 | 250 | |
243 | - if (empty($context['report']['mod_comments'])) |
|
244 | - echo ' |
|
251 | + if (empty($context['report']['mod_comments'])) { |
|
252 | + echo ' |
|
245 | 253 | <div class="information"> |
246 | 254 | <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p> |
247 | 255 | </div>'; |
256 | + } |
|
248 | 257 | |
249 | 258 | foreach ($context['report']['mod_comments'] as $comment) |
250 | 259 | { |
@@ -334,18 +343,20 @@ discard block |
||
334 | 343 | <div class="modbox"> |
335 | 344 | <ul>'; |
336 | 345 | |
337 | - foreach ($context['reported_members'] as $report) |
|
338 | - echo ' |
|
346 | + foreach ($context['reported_members'] as $report) { |
|
347 | + echo ' |
|
339 | 348 | <li class="smalltext"> |
340 | 349 | <a href="', $report['report_href'], '">', $report['user_name'], '</a> |
341 | 350 | </li>'; |
351 | + } |
|
342 | 352 | |
343 | 353 | // Don't have any reported members right now? |
344 | - if (empty($context['reported_members'])) |
|
345 | - echo ' |
|
354 | + if (empty($context['reported_members'])) { |
|
355 | + echo ' |
|
346 | 356 | <li> |
347 | 357 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
348 | 358 | </li>'; |
359 | + } |
|
349 | 360 | |
350 | 361 | echo ' |
351 | 362 | </ul> |
@@ -431,8 +442,9 @@ discard block |
||
431 | 442 | |
432 | 443 | // Prepare the comments... |
433 | 444 | $comments = array(); |
434 | - foreach ($report['comments'] as $comment) |
|
435 | - $comments[$comment['member']['id']] = $comment['member']['link']; |
|
445 | + foreach ($report['comments'] as $comment) { |
|
446 | + $comments[$comment['member']['id']] = $comment['member']['link']; |
|
447 | + } |
|
436 | 448 | |
437 | 449 | echo ' |
438 | 450 | ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), ' |
@@ -444,13 +456,15 @@ discard block |
||
444 | 456 | <li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>'; |
445 | 457 | |
446 | 458 | // Ban this user button. |
447 | - if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) |
|
448 | - echo ' |
|
459 | + if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id'])) { |
|
460 | + echo ' |
|
449 | 461 | <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>'; |
462 | + } |
|
450 | 463 | |
451 | - if (!$context['view_closed']) |
|
452 | - echo ' |
|
464 | + if (!$context['view_closed']) { |
|
465 | + echo ' |
|
453 | 466 | <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>'; |
467 | + } |
|
454 | 468 | |
455 | 469 | echo ' |
456 | 470 | </ul> |
@@ -458,11 +472,12 @@ discard block |
||
458 | 472 | } |
459 | 473 | |
460 | 474 | // Were none found? |
461 | - if (empty($context['reports'])) |
|
462 | - echo ' |
|
475 | + if (empty($context['reports'])) { |
|
476 | + echo ' |
|
463 | 477 | <div class="windowbg2"> |
464 | 478 | <p class="centertext">', $txt['mc_reportedp_none_found'], '</p> |
465 | 479 | </div>'; |
480 | + } |
|
466 | 481 | |
467 | 482 | echo ' |
468 | 483 | <div class="pagesection"> |
@@ -522,12 +537,13 @@ discard block |
||
522 | 537 | <h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3> |
523 | 538 | </div>'; |
524 | 539 | |
525 | - foreach ($context['report']['comments'] as $comment) |
|
526 | - echo ' |
|
540 | + foreach ($context['report']['comments'] as $comment) { |
|
541 | + echo ' |
|
527 | 542 | <div class="windowbg"> |
528 | 543 | <p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p> |
529 | 544 | <p>', $comment['message'], '</p> |
530 | 545 | </div>'; |
546 | + } |
|
531 | 547 | |
532 | 548 | echo ' |
533 | 549 | <br> |
@@ -536,11 +552,12 @@ discard block |
||
536 | 552 | </div> |
537 | 553 | <div>'; |
538 | 554 | |
539 | - if (empty($context['report']['mod_comments'])) |
|
540 | - echo ' |
|
555 | + if (empty($context['report']['mod_comments'])) { |
|
556 | + echo ' |
|
541 | 557 | <div class="information"> |
542 | 558 | <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p> |
543 | 559 | </div>'; |
560 | + } |
|
544 | 561 | |
545 | 562 | foreach ($context['report']['mod_comments'] as $comment) |
546 | 563 | { |