@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * Original module by Mach8 - We'll never forget you. |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * splits a topic into two topics. |
@@ -30,15 +31,17 @@ discard block |
||
| 30 | 31 | global $topic, $sourcedir; |
| 31 | 32 | |
| 32 | 33 | // And... which topic were you splitting, again? |
| 33 | - if (empty($topic)) |
|
| 34 | - fatal_lang_error('numbers_one_to_nine', false); |
|
| 34 | + if (empty($topic)) { |
|
| 35 | + fatal_lang_error('numbers_one_to_nine', false); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | // Are you allowed to split topics? |
| 37 | 39 | isAllowedTo('split_any'); |
| 38 | 40 | |
| 39 | 41 | // Load up the "dependencies" - the template, getMsgMemberID(), and sendNotifications(). |
| 40 | - if (!isset($_REQUEST['xml'])) |
|
| 41 | - loadTemplate('SplitTopics'); |
|
| 42 | + if (!isset($_REQUEST['xml'])) { |
|
| 43 | + loadTemplate('SplitTopics'); |
|
| 44 | + } |
|
| 42 | 45 | require_once($sourcedir . '/Subs-Boards.php'); |
| 43 | 46 | require_once($sourcedir . '/Subs-Post.php'); |
| 44 | 47 | |
@@ -50,12 +53,12 @@ discard block |
||
| 50 | 53 | ); |
| 51 | 54 | |
| 52 | 55 | // ?action=splittopics;sa=LETSBREAKIT won't work, sorry. |
| 53 | - if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) |
|
| 54 | - SplitIndex(); |
|
| 55 | - |
|
| 56 | - else |
|
| 57 | - call_helper($subActions[$_REQUEST['sa']]); |
|
| 58 | -} |
|
| 56 | + if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) { |
|
| 57 | + SplitIndex(); |
|
| 58 | + } else { |
|
| 59 | + call_helper($subActions[$_REQUEST['sa']]); |
|
| 60 | + } |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | /** |
| 61 | 64 | * screen shown before the actual split. |
@@ -71,8 +74,9 @@ discard block |
||
| 71 | 74 | global $txt, $topic, $context, $smcFunc, $modSettings; |
| 72 | 75 | |
| 73 | 76 | // Validate "at". |
| 74 | - if (empty($_GET['at'])) |
|
| 75 | - fatal_lang_error('numbers_one_to_nine', false); |
|
| 77 | + if (empty($_GET['at'])) { |
|
| 78 | + fatal_lang_error('numbers_one_to_nine', false); |
|
| 79 | + } |
|
| 76 | 80 | $_GET['at'] = (int) $_GET['at']; |
| 77 | 81 | |
| 78 | 82 | // Retrieve the subject and stuff of the specific topic/message. |
@@ -89,26 +93,31 @@ discard block |
||
| 89 | 93 | 'split_at' => $_GET['at'], |
| 90 | 94 | ) |
| 91 | 95 | ); |
| 92 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 93 | - fatal_lang_error('cant_find_messages'); |
|
| 96 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 97 | + fatal_lang_error('cant_find_messages'); |
|
| 98 | + } |
|
| 94 | 99 | list ($_REQUEST['subname'], $num_replies, $unapproved_posts, $id_first_msg, $approved) = $smcFunc['db_fetch_row']($request); |
| 95 | 100 | $smcFunc['db_free_result']($request); |
| 96 | 101 | |
| 97 | 102 | // If not approved validate they can see it. |
| 98 | - if ($modSettings['postmod_active'] && !$approved) |
|
| 99 | - isAllowedTo('approve_posts'); |
|
| 103 | + if ($modSettings['postmod_active'] && !$approved) { |
|
| 104 | + isAllowedTo('approve_posts'); |
|
| 105 | + } |
|
| 100 | 106 | |
| 101 | 107 | // If this topic has unapproved posts, we need to count them too... |
| 102 | - if ($modSettings['postmod_active'] && allowedTo('approve_posts')) |
|
| 103 | - $num_replies += $unapproved_posts - ($approved ? 0 : 1); |
|
| 108 | + if ($modSettings['postmod_active'] && allowedTo('approve_posts')) { |
|
| 109 | + $num_replies += $unapproved_posts - ($approved ? 0 : 1); |
|
| 110 | + } |
|
| 104 | 111 | |
| 105 | 112 | // Check if there is more than one message in the topic. (there should be.) |
| 106 | - if ($num_replies < 1) |
|
| 107 | - fatal_lang_error('topic_one_post', false); |
|
| 113 | + if ($num_replies < 1) { |
|
| 114 | + fatal_lang_error('topic_one_post', false); |
|
| 115 | + } |
|
| 108 | 116 | |
| 109 | 117 | // Check if this is the first message in the topic (if so, the first and second option won't be available) |
| 110 | - if ($id_first_msg == $_GET['at']) |
|
| 111 | - return SplitSelectTopics(); |
|
| 118 | + if ($id_first_msg == $_GET['at']) { |
|
| 119 | + return SplitSelectTopics(); |
|
| 120 | + } |
|
| 112 | 121 | |
| 113 | 122 | // Basic template information.... |
| 114 | 123 | $context['message'] = array( |
@@ -137,8 +146,9 @@ discard block |
||
| 137 | 146 | checkSession(); |
| 138 | 147 | |
| 139 | 148 | // Clean up the subject. |
| 140 | - if (!isset($_POST['subname']) || $_POST['subname'] == '') |
|
| 141 | - $_POST['subname'] = $txt['new_topic']; |
|
| 149 | + if (!isset($_POST['subname']) || $_POST['subname'] == '') { |
|
| 150 | + $_POST['subname'] = $txt['new_topic']; |
|
| 151 | + } |
|
| 142 | 152 | |
| 143 | 153 | // Redirect to the selector if they chose selective. |
| 144 | 154 | if ($_POST['step2'] == 'selective') |
@@ -163,16 +173,19 @@ discard block |
||
| 163 | 173 | 'split_at' => $_POST['at'], |
| 164 | 174 | ) |
| 165 | 175 | ); |
| 166 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 167 | - $messagesToBeSplit[] = $row['id_msg']; |
|
| 176 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 177 | + $messagesToBeSplit[] = $row['id_msg']; |
|
| 178 | + } |
|
| 168 | 179 | $smcFunc['db_free_result']($request); |
| 169 | 180 | } |
| 170 | 181 | // Only the selected message has to be split. That should be easy. |
| 171 | - elseif ($_POST['step2'] == 'onlythis') |
|
| 172 | - $messagesToBeSplit[] = $_POST['at']; |
|
| 182 | + elseif ($_POST['step2'] == 'onlythis') { |
|
| 183 | + $messagesToBeSplit[] = $_POST['at']; |
|
| 184 | + } |
|
| 173 | 185 | // There's another action?! |
| 174 | - else |
|
| 175 | - fatal_lang_error('no_access', false); |
|
| 186 | + else { |
|
| 187 | + fatal_lang_error('no_access', false); |
|
| 188 | + } |
|
| 176 | 189 | |
| 177 | 190 | $context['old_topic'] = $topic; |
| 178 | 191 | $context['new_topic'] = splitTopic($topic, $messagesToBeSplit, $_POST['subname']); |
@@ -199,8 +212,9 @@ discard block |
||
| 199 | 212 | $_SESSION['split_selection'][$topic] = empty($_SESSION['split_selection'][$topic]) ? array() : $_SESSION['split_selection'][$topic]; |
| 200 | 213 | |
| 201 | 214 | // This is a special case for split topics from quick-moderation checkboxes |
| 202 | - if (isset($_REQUEST['subname_enc'])) |
|
| 203 | - $_REQUEST['subname'] = urldecode($_REQUEST['subname_enc']); |
|
| 215 | + if (isset($_REQUEST['subname_enc'])) { |
|
| 216 | + $_REQUEST['subname'] = urldecode($_REQUEST['subname_enc']); |
|
| 217 | + } |
|
| 204 | 218 | |
| 205 | 219 | $context['not_selected'] = array( |
| 206 | 220 | 'num_messages' => 0, |
@@ -252,10 +266,12 @@ discard block |
||
| 252 | 266 | ) |
| 253 | 267 | ); |
| 254 | 268 | // You can't split the last message off. |
| 255 | - if (empty($context['not_selected']['start']) && $smcFunc['db_num_rows']($request) <= 1 && $_REQUEST['move'] == 'down') |
|
| 256 | - $_REQUEST['move'] = ''; |
|
| 257 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 258 | - $original_msgs['not_selected'][] = $row['id_msg']; |
|
| 269 | + if (empty($context['not_selected']['start']) && $smcFunc['db_num_rows']($request) <= 1 && $_REQUEST['move'] == 'down') { |
|
| 270 | + $_REQUEST['move'] = ''; |
|
| 271 | + } |
|
| 272 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 273 | + $original_msgs['not_selected'][] = $row['id_msg']; |
|
| 274 | + } |
|
| 259 | 275 | $smcFunc['db_free_result']($request); |
| 260 | 276 | if (!empty($_SESSION['split_selection'][$topic])) |
| 261 | 277 | { |
@@ -275,8 +291,9 @@ discard block |
||
| 275 | 291 | 'messages_per_page' => $context['messages_per_page'], |
| 276 | 292 | ) |
| 277 | 293 | ); |
| 278 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 279 | - $original_msgs['selected'][] = $row['id_msg']; |
|
| 294 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 295 | + $original_msgs['selected'][] = $row['id_msg']; |
|
| 296 | + } |
|
| 280 | 297 | $smcFunc['db_free_result']($request); |
| 281 | 298 | } |
| 282 | 299 | } |
@@ -286,12 +303,13 @@ discard block |
||
| 286 | 303 | { |
| 287 | 304 | $_REQUEST['msg'] = (int) $_REQUEST['msg']; |
| 288 | 305 | |
| 289 | - if ($_REQUEST['move'] == 'reset') |
|
| 290 | - $_SESSION['split_selection'][$topic] = array(); |
|
| 291 | - elseif ($_REQUEST['move'] == 'up') |
|
| 292 | - $_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_REQUEST['msg'])); |
|
| 293 | - else |
|
| 294 | - $_SESSION['split_selection'][$topic][] = $_REQUEST['msg']; |
|
| 306 | + if ($_REQUEST['move'] == 'reset') { |
|
| 307 | + $_SESSION['split_selection'][$topic] = array(); |
|
| 308 | + } elseif ($_REQUEST['move'] == 'up') { |
|
| 309 | + $_SESSION['split_selection'][$topic] = array_diff($_SESSION['split_selection'][$topic], array($_REQUEST['msg'])); |
|
| 310 | + } else { |
|
| 311 | + $_SESSION['split_selection'][$topic][] = $_REQUEST['msg']; |
|
| 312 | + } |
|
| 295 | 313 | } |
| 296 | 314 | |
| 297 | 315 | // Make sure the selection is still accurate. |
@@ -310,8 +328,9 @@ discard block |
||
| 310 | 328 | ) |
| 311 | 329 | ); |
| 312 | 330 | $_SESSION['split_selection'][$topic] = array(); |
| 313 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 314 | - $_SESSION['split_selection'][$topic][] = $row['id_msg']; |
|
| 331 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 332 | + $_SESSION['split_selection'][$topic][] = $row['id_msg']; |
|
| 333 | + } |
|
| 315 | 334 | $smcFunc['db_free_result']($request); |
| 316 | 335 | } |
| 317 | 336 | |
@@ -328,13 +347,15 @@ discard block |
||
| 328 | 347 | 'is_approved' => 1, |
| 329 | 348 | ) |
| 330 | 349 | ); |
| 331 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 332 | - $context[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected']['num_messages'] = $row['num_messages']; |
|
| 350 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 351 | + $context[empty($row['is_selected']) || $row['is_selected'] == 'f' ? 'not_selected' : 'selected']['num_messages'] = $row['num_messages']; |
|
| 352 | + } |
|
| 333 | 353 | $smcFunc['db_free_result']($request); |
| 334 | 354 | |
| 335 | 355 | // Fix an oversized starting page (to make sure both pageindexes are properly set). |
| 336 | - if ($context['selected']['start'] >= $context['selected']['num_messages']) |
|
| 337 | - $context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page']))); |
|
| 356 | + if ($context['selected']['start'] >= $context['selected']['num_messages']) { |
|
| 357 | + $context['selected']['start'] = $context['selected']['num_messages'] <= $context['messages_per_page'] ? 0 : ($context['selected']['num_messages'] - (($context['selected']['num_messages'] % $context['messages_per_page']) == 0 ? $context['messages_per_page'] : ($context['selected']['num_messages'] % $context['messages_per_page']))); |
|
| 358 | + } |
|
| 338 | 359 | |
| 339 | 360 | // Build a page list of the not-selected topics... |
| 340 | 361 | $context['not_selected']['page_index'] = constructPageIndex($scripturl . '?action=splittopics;sa=selectTopics;subname=' . strtr(urlencode($_REQUEST['subname']), array('%' => '%%')) . ';topic=' . $topic . '.%1$d;start2=' . $context['selected']['start'], $context['not_selected']['start'], $context['not_selected']['num_messages'], $context['messages_per_page'], true); |
@@ -434,11 +455,12 @@ discard block |
||
| 434 | 455 | ); |
| 435 | 456 | |
| 436 | 457 | $context['changes'] = array(); |
| 437 | - foreach ($changes as $change_type => $change_array) |
|
| 438 | - foreach ($change_array as $section => $msg_array) |
|
| 458 | + foreach ($changes as $change_type => $change_array) { |
|
| 459 | + foreach ($change_array as $section => $msg_array) |
|
| 439 | 460 | { |
| 440 | 461 | if (empty($msg_array)) |
| 441 | 462 | continue; |
| 463 | + } |
|
| 442 | 464 | |
| 443 | 465 | foreach ($msg_array as $id_msg) |
| 444 | 466 | { |
@@ -447,8 +469,9 @@ discard block |
||
| 447 | 469 | 'type' => $change_type, |
| 448 | 470 | 'section' => $section, |
| 449 | 471 | ); |
| 450 | - if ($change_type == 'insert') |
|
| 451 | - $context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg]; |
|
| 472 | + if ($change_type == 'insert') { |
|
| 473 | + $context['changes']['insert' . $id_msg]['insert_value'] = $context[$section]['messages'][$id_msg]; |
|
| 474 | + } |
|
| 452 | 475 | } |
| 453 | 476 | } |
| 454 | 477 | } |
@@ -468,12 +491,14 @@ discard block |
||
| 468 | 491 | checkSession(); |
| 469 | 492 | |
| 470 | 493 | // Default the subject in case it's blank. |
| 471 | - if (!isset($_POST['subname']) || $_POST['subname'] == '') |
|
| 472 | - $_POST['subname'] = $txt['new_topic']; |
|
| 494 | + if (!isset($_POST['subname']) || $_POST['subname'] == '') { |
|
| 495 | + $_POST['subname'] = $txt['new_topic']; |
|
| 496 | + } |
|
| 473 | 497 | |
| 474 | 498 | // You must've selected some messages! Can't split out none! |
| 475 | - if (empty($_SESSION['split_selection'][$topic])) |
|
| 476 | - fatal_lang_error('no_posts_selected', false); |
|
| 499 | + if (empty($_SESSION['split_selection'][$topic])) { |
|
| 500 | + fatal_lang_error('no_posts_selected', false); |
|
| 501 | + } |
|
| 477 | 502 | |
| 478 | 503 | $context['old_topic'] = $topic; |
| 479 | 504 | $context['new_topic'] = splitTopic($topic, $_SESSION['split_selection'][$topic], $_POST['subname']); |
@@ -499,8 +524,9 @@ discard block |
||
| 499 | 524 | global $smcFunc, $txt, $sourcedir; |
| 500 | 525 | |
| 501 | 526 | // Nothing to split? |
| 502 | - if (empty($splitMessages)) |
|
| 503 | - fatal_lang_error('no_posts_selected', false); |
|
| 527 | + if (empty($splitMessages)) { |
|
| 528 | + fatal_lang_error('no_posts_selected', false); |
|
| 529 | + } |
|
| 504 | 530 | |
| 505 | 531 | // Get some board info. |
| 506 | 532 | $request = $smcFunc['db_query']('', ' |
@@ -532,8 +558,9 @@ discard block |
||
| 532 | 558 | ) |
| 533 | 559 | ); |
| 534 | 560 | // You can't select ALL the messages! |
| 535 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 536 | - fatal_lang_error('selected_all_posts', false); |
|
| 561 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 562 | + fatal_lang_error('selected_all_posts', false); |
|
| 563 | + } |
|
| 537 | 564 | |
| 538 | 565 | $split1_first_msg = null; |
| 539 | 566 | $split1_last_msg = null; |
@@ -541,24 +568,27 @@ discard block |
||
| 541 | 568 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 542 | 569 | { |
| 543 | 570 | // Get the right first and last message dependant on approved state... |
| 544 | - if (empty($split1_first_msg) || $row['myid_first_msg'] < $split1_first_msg) |
|
| 545 | - $split1_first_msg = $row['myid_first_msg']; |
|
| 546 | - if (empty($split1_last_msg) || $row['approved']) |
|
| 547 | - $split1_last_msg = $row['myid_last_msg']; |
|
| 571 | + if (empty($split1_first_msg) || $row['myid_first_msg'] < $split1_first_msg) { |
|
| 572 | + $split1_first_msg = $row['myid_first_msg']; |
|
| 573 | + } |
|
| 574 | + if (empty($split1_last_msg) || $row['approved']) { |
|
| 575 | + $split1_last_msg = $row['myid_last_msg']; |
|
| 576 | + } |
|
| 548 | 577 | |
| 549 | 578 | // Get the counts correct... |
| 550 | 579 | if ($row['approved']) |
| 551 | 580 | { |
| 552 | 581 | $split1_replies = $row['message_count'] - 1; |
| 553 | 582 | $split1_unapprovedposts = 0; |
| 554 | - } |
|
| 555 | - else |
|
| 583 | + } else |
|
| 556 | 584 | { |
| 557 | - if (!isset($split1_replies)) |
|
| 558 | - $split1_replies = 0; |
|
| 585 | + if (!isset($split1_replies)) { |
|
| 586 | + $split1_replies = 0; |
|
| 587 | + } |
|
| 559 | 588 | // If the topic isn't approved then num replies must go up by one... as first post wouldn't be counted. |
| 560 | - elseif (!$split1_approved) |
|
| 561 | - $split1_replies++; |
|
| 589 | + elseif (!$split1_approved) { |
|
| 590 | + $split1_replies++; |
|
| 591 | + } |
|
| 562 | 592 | |
| 563 | 593 | $split1_unapprovedposts = $row['message_count']; |
| 564 | 594 | } |
@@ -584,10 +614,12 @@ discard block |
||
| 584 | 614 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 585 | 615 | { |
| 586 | 616 | // As before get the right first and last message dependant on approved state... |
| 587 | - if (empty($split2_first_msg) || $row['myid_first_msg'] < $split2_first_msg) |
|
| 588 | - $split2_first_msg = $row['myid_first_msg']; |
|
| 589 | - if (empty($split2_last_msg) || $row['approved']) |
|
| 590 | - $split2_last_msg = $row['myid_last_msg']; |
|
| 617 | + if (empty($split2_first_msg) || $row['myid_first_msg'] < $split2_first_msg) { |
|
| 618 | + $split2_first_msg = $row['myid_first_msg']; |
|
| 619 | + } |
|
| 620 | + if (empty($split2_last_msg) || $row['approved']) { |
|
| 621 | + $split2_last_msg = $row['myid_last_msg']; |
|
| 622 | + } |
|
| 591 | 623 | |
| 592 | 624 | // Then do the counts again... |
| 593 | 625 | if ($row['approved']) |
@@ -595,18 +627,20 @@ discard block |
||
| 595 | 627 | $split2_approved = true; |
| 596 | 628 | $split2_replies = $row['message_count'] - 1; |
| 597 | 629 | $split2_unapprovedposts = 0; |
| 598 | - } |
|
| 599 | - else |
|
| 630 | + } else |
|
| 600 | 631 | { |
| 601 | 632 | // Should this one be approved?? |
| 602 | - if ($split2_first_msg == $row['myid_first_msg']) |
|
| 603 | - $split2_approved = false; |
|
| 633 | + if ($split2_first_msg == $row['myid_first_msg']) { |
|
| 634 | + $split2_approved = false; |
|
| 635 | + } |
|
| 604 | 636 | |
| 605 | - if (!isset($split2_replies)) |
|
| 606 | - $split2_replies = 0; |
|
| 637 | + if (!isset($split2_replies)) { |
|
| 638 | + $split2_replies = 0; |
|
| 639 | + } |
|
| 607 | 640 | // As before, fix number of replies. |
| 608 | - elseif (!$split2_approved) |
|
| 609 | - $split2_replies++; |
|
| 641 | + elseif (!$split2_approved) { |
|
| 642 | + $split2_replies++; |
|
| 643 | + } |
|
| 610 | 644 | |
| 611 | 645 | $split2_unapprovedposts = $row['message_count']; |
| 612 | 646 | } |
@@ -616,12 +650,14 @@ discard block |
||
| 616 | 650 | $split2_lastMem = getMsgMemberID($split2_last_msg); |
| 617 | 651 | |
| 618 | 652 | // No database changes yet, so let's double check to see if everything makes at least a little sense. |
| 619 | - if ($split1_first_msg <= 0 || $split1_last_msg <= 0 || $split2_first_msg <= 0 || $split2_last_msg <= 0 || $split1_replies < 0 || $split2_replies < 0 || $split1_unapprovedposts < 0 || $split2_unapprovedposts < 0 || !isset($split1_approved) || !isset($split2_approved)) |
|
| 620 | - fatal_lang_error('cant_find_messages'); |
|
| 653 | + if ($split1_first_msg <= 0 || $split1_last_msg <= 0 || $split2_first_msg <= 0 || $split2_last_msg <= 0 || $split1_replies < 0 || $split2_replies < 0 || $split1_unapprovedposts < 0 || $split2_unapprovedposts < 0 || !isset($split1_approved) || !isset($split2_approved)) { |
|
| 654 | + fatal_lang_error('cant_find_messages'); |
|
| 655 | + } |
|
| 621 | 656 | |
| 622 | 657 | // You cannot split off the first message of a topic. |
| 623 | - if ($split1_first_msg > $split2_first_msg) |
|
| 624 | - fatal_lang_error('split_first_post', false); |
|
| 658 | + if ($split1_first_msg > $split2_first_msg) { |
|
| 659 | + fatal_lang_error('split_first_post', false); |
|
| 660 | + } |
|
| 625 | 661 | |
| 626 | 662 | // We're off to insert the new topic! Use 0 for now to avoid UNIQUE errors. |
| 627 | 663 | $split2_ID_TOPIC = $smcFunc['db_insert']('', |
@@ -644,14 +680,16 @@ discard block |
||
| 644 | 680 | array('id_topic'), |
| 645 | 681 | 1 |
| 646 | 682 | ); |
| 647 | - if ($split2_ID_TOPIC <= 0) |
|
| 648 | - fatal_lang_error('cant_insert_topic'); |
|
| 683 | + if ($split2_ID_TOPIC <= 0) { |
|
| 684 | + fatal_lang_error('cant_insert_topic'); |
|
| 685 | + } |
|
| 649 | 686 | |
| 650 | 687 | // Move the messages over to the other topic. |
| 651 | 688 | $new_subject = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($new_subject)), array("\r" => '', "\n" => '', "\t" => '')); |
| 652 | 689 | // Check the subject length. |
| 653 | - if ($smcFunc['strlen']($new_subject) > 100) |
|
| 654 | - $new_subject = $smcFunc['substr']($new_subject, 0, 100); |
|
| 690 | + if ($smcFunc['strlen']($new_subject) > 100) { |
|
| 691 | + $new_subject = $smcFunc['substr']($new_subject, 0, 100); |
|
| 692 | + } |
|
| 655 | 693 | // Valid subject? |
| 656 | 694 | if ($new_subject != '') |
| 657 | 695 | { |
@@ -722,8 +760,8 @@ discard block |
||
| 722 | 760 | ); |
| 723 | 761 | |
| 724 | 762 | // If the new topic isn't approved ensure the first message flags this just in case. |
| 725 | - if (!$split2_approved) |
|
| 726 | - $smcFunc['db_query']('', ' |
|
| 763 | + if (!$split2_approved) { |
|
| 764 | + $smcFunc['db_query']('', ' |
|
| 727 | 765 | UPDATE {db_prefix}messages |
| 728 | 766 | SET approved = {int:approved} |
| 729 | 767 | WHERE id_msg = {int:id_msg} |
@@ -734,6 +772,7 @@ discard block |
||
| 734 | 772 | 'id_topic' => $split2_ID_TOPIC, |
| 735 | 773 | ) |
| 736 | 774 | ); |
| 775 | + } |
|
| 737 | 776 | |
| 738 | 777 | // The board has more topics now (Or more unapproved ones!). |
| 739 | 778 | $smcFunc['db_query']('', ' |
@@ -760,8 +799,9 @@ discard block |
||
| 760 | 799 | if ($smcFunc['db_num_rows']($request) > 0) |
| 761 | 800 | { |
| 762 | 801 | $replaceEntries = array(); |
| 763 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 764 | - $replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']); |
|
| 802 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 803 | + $replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']); |
|
| 804 | + } |
|
| 765 | 805 | |
| 766 | 806 | $smcFunc['db_insert']('ignore', |
| 767 | 807 | '{db_prefix}log_topics', |
@@ -785,8 +825,9 @@ discard block |
||
| 785 | 825 | // If there's a search index that needs updating, update it... |
| 786 | 826 | require_once($sourcedir . '/Search.php'); |
| 787 | 827 | $searchAPI = findSearchAPI(); |
| 788 | - if (is_callable(array($searchAPI, 'topicSplit'))) |
|
| 789 | - $searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages); |
|
| 828 | + if (is_callable(array($searchAPI, 'topicSplit'))) { |
|
| 829 | + $searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages); |
|
| 830 | + } |
|
| 790 | 831 | |
| 791 | 832 | // Maybe we want to let an external CMS know about this split |
| 792 | 833 | $split1 = array( |
@@ -833,12 +874,12 @@ discard block |
||
| 833 | 874 | ); |
| 834 | 875 | |
| 835 | 876 | // ?action=mergetopics;sa=LETSBREAKIT won't work, sorry. |
| 836 | - if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) |
|
| 837 | - MergeIndex(); |
|
| 838 | - |
|
| 839 | - else |
|
| 840 | - call_helper($subActions[$_REQUEST['sa']]); |
|
| 841 | -} |
|
| 877 | + if (empty($_REQUEST['sa']) || !isset($subActions[$_REQUEST['sa']])) { |
|
| 878 | + MergeIndex(); |
|
| 879 | + } else { |
|
| 880 | + call_helper($subActions[$_REQUEST['sa']]); |
|
| 881 | + } |
|
| 882 | + } |
|
| 842 | 883 | |
| 843 | 884 | /** |
| 844 | 885 | * allows to pick a topic to merge the current topic with. |
@@ -852,8 +893,9 @@ discard block |
||
| 852 | 893 | global $txt, $board, $context, $smcFunc, $sourcedir; |
| 853 | 894 | global $scripturl, $modSettings; |
| 854 | 895 | |
| 855 | - if (!isset($_GET['from'])) |
|
| 856 | - fatal_lang_error('no_access', false); |
|
| 896 | + if (!isset($_GET['from'])) { |
|
| 897 | + fatal_lang_error('no_access', false); |
|
| 898 | + } |
|
| 857 | 899 | $_GET['from'] = (int) $_GET['from']; |
| 858 | 900 | |
| 859 | 901 | $_REQUEST['targetboard'] = isset($_REQUEST['targetboard']) ? (int) $_REQUEST['targetboard'] : $board; |
@@ -864,9 +906,9 @@ discard block |
||
| 864 | 906 | { |
| 865 | 907 | $can_approve_boards = boardsAllowedTo('approve_posts'); |
| 866 | 908 | $onlyApproved = $can_approve_boards !== array(0) && !in_array($_REQUEST['targetboard'], $can_approve_boards); |
| 909 | + } else { |
|
| 910 | + $onlyApproved = false; |
|
| 867 | 911 | } |
| 868 | - else |
|
| 869 | - $onlyApproved = false; |
|
| 870 | 912 | |
| 871 | 913 | // How many topics are on this board? (used for paging.) |
| 872 | 914 | $request = $smcFunc['db_query']('', ' |
@@ -900,8 +942,9 @@ discard block |
||
| 900 | 942 | 'is_approved' => 1, |
| 901 | 943 | ) |
| 902 | 944 | ); |
| 903 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 904 | - fatal_lang_error('no_board'); |
|
| 945 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 946 | + fatal_lang_error('no_board'); |
|
| 947 | + } |
|
| 905 | 948 | list ($subject) = $smcFunc['db_fetch_row']($request); |
| 906 | 949 | $smcFunc['db_free_result']($request); |
| 907 | 950 | |
@@ -914,8 +957,9 @@ discard block |
||
| 914 | 957 | // Check which boards you have merge permissions on. |
| 915 | 958 | $merge_boards = boardsAllowedTo('merge_any'); |
| 916 | 959 | |
| 917 | - if (empty($merge_boards)) |
|
| 918 | - fatal_lang_error('cannot_merge_any', 'user'); |
|
| 960 | + if (empty($merge_boards)) { |
|
| 961 | + fatal_lang_error('cannot_merge_any', 'user'); |
|
| 962 | + } |
|
| 919 | 963 | |
| 920 | 964 | // No sense in loading this if you can only merge on this board |
| 921 | 965 | if (count($merge_boards) > 1 || in_array(0, $merge_boards)) |
@@ -929,8 +973,9 @@ discard block |
||
| 929 | 973 | ); |
| 930 | 974 | |
| 931 | 975 | // Only include these boards in the list (0 means you're an admin') |
| 932 | - if (!in_array(0, $merge_boards)) |
|
| 933 | - $options['included_boards'] = $merge_boards; |
|
| 976 | + if (!in_array(0, $merge_boards)) { |
|
| 977 | + $options['included_boards'] = $merge_boards; |
|
| 978 | + } |
|
| 934 | 979 | |
| 935 | 980 | $context['merge_categories'] = getBoardList($options); |
| 936 | 981 | } |
@@ -976,8 +1021,9 @@ discard block |
||
| 976 | 1021 | } |
| 977 | 1022 | $smcFunc['db_free_result']($request); |
| 978 | 1023 | |
| 979 | - if (empty($context['topics']) && count($merge_boards) <= 1 && !in_array(0, $merge_boards)) |
|
| 980 | - fatal_lang_error('merge_need_more_topics'); |
|
| 1024 | + if (empty($context['topics']) && count($merge_boards) <= 1 && !in_array(0, $merge_boards)) { |
|
| 1025 | + fatal_lang_error('merge_need_more_topics'); |
|
| 1026 | + } |
|
| 981 | 1027 | |
| 982 | 1028 | $context['sub_template'] = 'merge'; |
| 983 | 1029 | } |
@@ -1007,24 +1053,29 @@ discard block |
||
| 1007 | 1053 | checkSession('request'); |
| 1008 | 1054 | |
| 1009 | 1055 | // Handle URLs from MergeIndex. |
| 1010 | - if (!empty($_GET['from']) && !empty($_GET['to'])) |
|
| 1011 | - $topics = array((int) $_GET['from'], (int) $_GET['to']); |
|
| 1056 | + if (!empty($_GET['from']) && !empty($_GET['to'])) { |
|
| 1057 | + $topics = array((int) $_GET['from'], (int) $_GET['to']); |
|
| 1058 | + } |
|
| 1012 | 1059 | |
| 1013 | 1060 | // If we came from a form, the topic IDs came by post. |
| 1014 | - if (!empty($_POST['topics']) && is_array($_POST['topics'])) |
|
| 1015 | - $topics = $_POST['topics']; |
|
| 1061 | + if (!empty($_POST['topics']) && is_array($_POST['topics'])) { |
|
| 1062 | + $topics = $_POST['topics']; |
|
| 1063 | + } |
|
| 1016 | 1064 | |
| 1017 | 1065 | // There's nothing to merge with just one topic... |
| 1018 | - if (empty($topics) || !is_array($topics) || count($topics) == 1) |
|
| 1019 | - fatal_lang_error('merge_need_more_topics'); |
|
| 1066 | + if (empty($topics) || !is_array($topics) || count($topics) == 1) { |
|
| 1067 | + fatal_lang_error('merge_need_more_topics'); |
|
| 1068 | + } |
|
| 1020 | 1069 | |
| 1021 | 1070 | // Make sure every topic is numeric, or some nasty things could be done with the DB. |
| 1022 | - foreach ($topics as $id => $topic) |
|
| 1023 | - $topics[$id] = (int) $topic; |
|
| 1071 | + foreach ($topics as $id => $topic) { |
|
| 1072 | + $topics[$id] = (int) $topic; |
|
| 1073 | + } |
|
| 1024 | 1074 | |
| 1025 | 1075 | // Joy of all joys, make sure they're not messing about with unapproved topics they can't see :P |
| 1026 | - if ($modSettings['postmod_active']) |
|
| 1027 | - $can_approve_boards = boardsAllowedTo('approve_posts'); |
|
| 1076 | + if ($modSettings['postmod_active']) { |
|
| 1077 | + $can_approve_boards = boardsAllowedTo('approve_posts'); |
|
| 1078 | + } |
|
| 1028 | 1079 | |
| 1029 | 1080 | // Get info about the topics and polls that will be merged. |
| 1030 | 1081 | $request = $smcFunc['db_query']('', ' |
@@ -1045,8 +1096,9 @@ discard block |
||
| 1045 | 1096 | 'limit' => count($topics), |
| 1046 | 1097 | ) |
| 1047 | 1098 | ); |
| 1048 | - if ($smcFunc['db_num_rows']($request) < 2) |
|
| 1049 | - fatal_lang_error('no_topic_id'); |
|
| 1099 | + if ($smcFunc['db_num_rows']($request) < 2) { |
|
| 1100 | + fatal_lang_error('no_topic_id'); |
|
| 1101 | + } |
|
| 1050 | 1102 | $num_views = 0; |
| 1051 | 1103 | $is_sticky = 0; |
| 1052 | 1104 | $boardTotals = array(); |
@@ -1059,34 +1111,38 @@ discard block |
||
| 1059 | 1111 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1060 | 1112 | { |
| 1061 | 1113 | // Sorry, redirection topics can't be merged |
| 1062 | - if (!empty($row['id_redirect_topic'])) |
|
| 1063 | - fatal_lang_error('cannot_merge_redirect', false); |
|
| 1114 | + if (!empty($row['id_redirect_topic'])) { |
|
| 1115 | + fatal_lang_error('cannot_merge_redirect', false); |
|
| 1116 | + } |
|
| 1064 | 1117 | |
| 1065 | 1118 | // Make a note for the board counts... |
| 1066 | - if (!isset($boardTotals[$row['id_board']])) |
|
| 1067 | - $boardTotals[$row['id_board']] = array( |
|
| 1119 | + if (!isset($boardTotals[$row['id_board']])) { |
|
| 1120 | + $boardTotals[$row['id_board']] = array( |
|
| 1068 | 1121 | 'posts' => 0, |
| 1069 | 1122 | 'topics' => 0, |
| 1070 | 1123 | 'unapproved_posts' => 0, |
| 1071 | 1124 | 'unapproved_topics' => 0 |
| 1072 | 1125 | ); |
| 1126 | + } |
|
| 1073 | 1127 | |
| 1074 | 1128 | // We can't see unapproved topics here? |
| 1075 | 1129 | if ($modSettings['postmod_active'] && !$row['approved'] && $can_approve_boards != array(0) && in_array($row['id_board'], $can_approve_boards)) |
| 1076 | 1130 | { |
| 1077 | 1131 | unset($topics[$row['id_topic']]); // If we can't see it, we should not merge it and not adjust counts! Instead skip it. |
| 1078 | 1132 | continue; |
| 1079 | - }elseif (!$row['approved']) |
|
| 1080 | - $boardTotals[$row['id_board']]['unapproved_topics']++; |
|
| 1081 | - else |
|
| 1082 | - $boardTotals[$row['id_board']]['topics']++; |
|
| 1133 | + } elseif (!$row['approved']) { |
|
| 1134 | + $boardTotals[$row['id_board']]['unapproved_topics']++; |
|
| 1135 | + } else { |
|
| 1136 | + $boardTotals[$row['id_board']]['topics']++; |
|
| 1137 | + } |
|
| 1083 | 1138 | |
| 1084 | 1139 | $boardTotals[$row['id_board']]['unapproved_posts'] += $row['unapproved_posts']; |
| 1085 | 1140 | $boardTotals[$row['id_board']]['posts'] += $row['num_replies'] + ($row['approved'] ? 1 : 0); |
| 1086 | 1141 | |
| 1087 | 1142 | // In the case of making a redirect, the topic count goes up by one due to the redirect topic. |
| 1088 | - if (isset($_POST['postRedirect'])) |
|
| 1089 | - $boardTotals[$row['id_board']]['topics']--; |
|
| 1143 | + if (isset($_POST['postRedirect'])) { |
|
| 1144 | + $boardTotals[$row['id_board']]['topics']--; |
|
| 1145 | + } |
|
| 1090 | 1146 | |
| 1091 | 1147 | $topic_data[$row['id_topic']] = array( |
| 1092 | 1148 | 'id' => $row['id_topic'], |
@@ -1112,11 +1168,13 @@ discard block |
||
| 1112 | 1168 | $boards[] = $row['id_board']; |
| 1113 | 1169 | |
| 1114 | 1170 | // If there's no poll, id_poll == 0... |
| 1115 | - if ($row['id_poll'] > 0) |
|
| 1116 | - $polls[] = $row['id_poll']; |
|
| 1171 | + if ($row['id_poll'] > 0) { |
|
| 1172 | + $polls[] = $row['id_poll']; |
|
| 1173 | + } |
|
| 1117 | 1174 | // Store the id_topic with the lowest id_first_msg. |
| 1118 | - if (empty($firstTopic)) |
|
| 1119 | - $firstTopic = $row['id_topic']; |
|
| 1175 | + if (empty($firstTopic)) { |
|
| 1176 | + $firstTopic = $row['id_topic']; |
|
| 1177 | + } |
|
| 1120 | 1178 | |
| 1121 | 1179 | // Lowest topic id gets selected as surviving topic id. We need to store this board so we can adjust the topic count (This one will not have a redirect topic) |
| 1122 | 1180 | if ($row['id_topic'] < $lowestTopicId || empty($lowestTopicId)) |
@@ -1130,11 +1188,13 @@ discard block |
||
| 1130 | 1188 | $smcFunc['db_free_result']($request); |
| 1131 | 1189 | |
| 1132 | 1190 | // If we didn't get any topics then they've been messing with unapproved stuff. |
| 1133 | - if (empty($topic_data)) |
|
| 1134 | - fatal_lang_error('no_topic_id'); |
|
| 1191 | + if (empty($topic_data)) { |
|
| 1192 | + fatal_lang_error('no_topic_id'); |
|
| 1193 | + } |
|
| 1135 | 1194 | |
| 1136 | - if (isset($_POST['postRedirect']) && !empty($lowestTopicBoard)) |
|
| 1137 | - $boardTotals[$lowestTopicBoard]['topics']++; |
|
| 1195 | + if (isset($_POST['postRedirect']) && !empty($lowestTopicBoard)) { |
|
| 1196 | + $boardTotals[$lowestTopicBoard]['topics']++; |
|
| 1197 | + } |
|
| 1138 | 1198 | |
| 1139 | 1199 | // Will this be approved? |
| 1140 | 1200 | $context['is_approved'] = $topic_data[$firstTopic]['approved']; |
@@ -1150,8 +1210,9 @@ discard block |
||
| 1150 | 1210 | |
| 1151 | 1211 | // Get the boards a user is allowed to merge in. |
| 1152 | 1212 | $merge_boards = boardsAllowedTo('merge_any'); |
| 1153 | - if (empty($merge_boards)) |
|
| 1154 | - fatal_lang_error('cannot_merge_any', 'user'); |
|
| 1213 | + if (empty($merge_boards)) { |
|
| 1214 | + fatal_lang_error('cannot_merge_any', 'user'); |
|
| 1215 | + } |
|
| 1155 | 1216 | |
| 1156 | 1217 | // Make sure they can see all boards.... |
| 1157 | 1218 | $request = $smcFunc['db_query']('', ' |
@@ -1168,8 +1229,9 @@ discard block |
||
| 1168 | 1229 | ) |
| 1169 | 1230 | ); |
| 1170 | 1231 | // If the number of boards that's in the output isn't exactly the same as we've put in there, you're in trouble. |
| 1171 | - if ($smcFunc['db_num_rows']($request) != count($boards)) |
|
| 1172 | - fatal_lang_error('no_board'); |
|
| 1232 | + if ($smcFunc['db_num_rows']($request) != count($boards)) { |
|
| 1233 | + fatal_lang_error('no_board'); |
|
| 1234 | + } |
|
| 1173 | 1235 | $smcFunc['db_free_result']($request); |
| 1174 | 1236 | |
| 1175 | 1237 | if (empty($_REQUEST['sa']) || $_REQUEST['sa'] == 'options') |
@@ -1188,8 +1250,8 @@ discard block |
||
| 1188 | 1250 | 'limit' => count($polls), |
| 1189 | 1251 | ) |
| 1190 | 1252 | ); |
| 1191 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1192 | - $context['polls'][] = array( |
|
| 1253 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1254 | + $context['polls'][] = array( |
|
| 1193 | 1255 | 'id' => $row['id_poll'], |
| 1194 | 1256 | 'topic' => array( |
| 1195 | 1257 | 'id' => $row['id_topic'], |
@@ -1198,6 +1260,7 @@ discard block |
||
| 1198 | 1260 | 'question' => $row['question'], |
| 1199 | 1261 | 'selected' => $row['id_topic'] == $firstTopic |
| 1200 | 1262 | ); |
| 1263 | + } |
|
| 1201 | 1264 | $smcFunc['db_free_result']($request); |
| 1202 | 1265 | } |
| 1203 | 1266 | if (count($boards) > 1) |
@@ -1213,18 +1276,20 @@ discard block |
||
| 1213 | 1276 | 'limit' => count($boards), |
| 1214 | 1277 | ) |
| 1215 | 1278 | ); |
| 1216 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1217 | - $context['boards'][] = array( |
|
| 1279 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1280 | + $context['boards'][] = array( |
|
| 1218 | 1281 | 'id' => $row['id_board'], |
| 1219 | 1282 | 'name' => $row['name'], |
| 1220 | 1283 | 'selected' => $row['id_board'] == $topic_data[$firstTopic]['board'] |
| 1221 | 1284 | ); |
| 1285 | + } |
|
| 1222 | 1286 | $smcFunc['db_free_result']($request); |
| 1223 | 1287 | } |
| 1224 | 1288 | |
| 1225 | 1289 | $context['topics'] = $topic_data; |
| 1226 | - foreach ($topic_data as $id => $topic) |
|
| 1227 | - $context['topics'][$id]['selected'] = $topic['id'] == $firstTopic; |
|
| 1290 | + foreach ($topic_data as $id => $topic) { |
|
| 1291 | + $context['topics'][$id]['selected'] = $topic['id'] == $firstTopic; |
|
| 1292 | + } |
|
| 1228 | 1293 | |
| 1229 | 1294 | $context['page_title'] = $txt['merge']; |
| 1230 | 1295 | $context['sub_template'] = 'merge_extra_options'; |
@@ -1233,13 +1298,15 @@ discard block |
||
| 1233 | 1298 | |
| 1234 | 1299 | // Determine target board. |
| 1235 | 1300 | $target_board = count($boards) > 1 ? (int) $_REQUEST['board'] : $boards[0]; |
| 1236 | - if (!in_array($target_board, $boards)) |
|
| 1237 | - fatal_lang_error('no_board'); |
|
| 1301 | + if (!in_array($target_board, $boards)) { |
|
| 1302 | + fatal_lang_error('no_board'); |
|
| 1303 | + } |
|
| 1238 | 1304 | |
| 1239 | 1305 | // Determine which poll will survive and which polls won't. |
| 1240 | 1306 | $target_poll = count($polls) > 1 ? (int) $_POST['poll'] : (count($polls) == 1 ? $polls[0] : 0); |
| 1241 | - if ($target_poll > 0 && !in_array($target_poll, $polls)) |
|
| 1242 | - fatal_lang_error('no_access', false); |
|
| 1307 | + if ($target_poll > 0 && !in_array($target_poll, $polls)) { |
|
| 1308 | + fatal_lang_error('no_access', false); |
|
| 1309 | + } |
|
| 1243 | 1310 | $deleted_polls = empty($target_poll) ? $polls : array_diff($polls, array($target_poll)); |
| 1244 | 1311 | |
| 1245 | 1312 | // Determine the subject of the newly merged topic - was a custom subject specified? |
@@ -1247,19 +1314,23 @@ discard block |
||
| 1247 | 1314 | { |
| 1248 | 1315 | $target_subject = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => '')); |
| 1249 | 1316 | // Keep checking the length. |
| 1250 | - if ($smcFunc['strlen']($target_subject) > 100) |
|
| 1251 | - $target_subject = $smcFunc['substr']($target_subject, 0, 100); |
|
| 1317 | + if ($smcFunc['strlen']($target_subject) > 100) { |
|
| 1318 | + $target_subject = $smcFunc['substr']($target_subject, 0, 100); |
|
| 1319 | + } |
|
| 1252 | 1320 | |
| 1253 | 1321 | // Nothing left - odd but pick the first topics subject. |
| 1254 | - if ($target_subject == '') |
|
| 1255 | - $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1322 | + if ($target_subject == '') { |
|
| 1323 | + $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1324 | + } |
|
| 1256 | 1325 | } |
| 1257 | 1326 | // A subject was selected from the list. |
| 1258 | - elseif (!empty($topic_data[(int) $_POST['subject']]['subject'])) |
|
| 1259 | - $target_subject = $topic_data[(int) $_POST['subject']]['subject']; |
|
| 1327 | + elseif (!empty($topic_data[(int) $_POST['subject']]['subject'])) { |
|
| 1328 | + $target_subject = $topic_data[(int) $_POST['subject']]['subject']; |
|
| 1329 | + } |
|
| 1260 | 1330 | // Nothing worked? Just take the subject of the first message. |
| 1261 | - else |
|
| 1262 | - $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1331 | + else { |
|
| 1332 | + $target_subject = $topic_data[$firstTopic]['subject']; |
|
| 1333 | + } |
|
| 1263 | 1334 | |
| 1264 | 1335 | // Get the first and last message and the number of messages.... |
| 1265 | 1336 | $request = $smcFunc['db_query']('', ' |
@@ -1285,15 +1356,13 @@ discard block |
||
| 1285 | 1356 | { |
| 1286 | 1357 | $num_replies = $row['message_count'] - 1; |
| 1287 | 1358 | $num_unapproved = 0; |
| 1288 | - } |
|
| 1289 | - else |
|
| 1359 | + } else |
|
| 1290 | 1360 | { |
| 1291 | 1361 | $topic_approved = 0; |
| 1292 | 1362 | $num_replies = 0; |
| 1293 | 1363 | $num_unapproved = $row['message_count']; |
| 1294 | 1364 | } |
| 1295 | - } |
|
| 1296 | - else |
|
| 1365 | + } else |
|
| 1297 | 1366 | { |
| 1298 | 1367 | // If this has a lower first_msg then the first post is not approved and hence the number of replies was wrong! |
| 1299 | 1368 | if ($first_msg > $row['first_msg']) |
@@ -1339,8 +1408,9 @@ discard block |
||
| 1339 | 1408 | list ($member_started) = $smcFunc['db_fetch_row']($request); |
| 1340 | 1409 | list ($member_updated) = $smcFunc['db_fetch_row']($request); |
| 1341 | 1410 | // First and last message are the same, so only row was returned. |
| 1342 | - if ($member_updated === NULL) |
|
| 1343 | - $member_updated = $member_started; |
|
| 1411 | + if ($member_updated === NULL) { |
|
| 1412 | + $member_updated = $member_started; |
|
| 1413 | + } |
|
| 1344 | 1414 | |
| 1345 | 1415 | $smcFunc['db_free_result']($request); |
| 1346 | 1416 | |
@@ -1353,8 +1423,9 @@ discard block |
||
| 1353 | 1423 | array( |
| 1354 | 1424 | 'topic_list' => $topics, |
| 1355 | 1425 | )); |
| 1356 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1357 | - $affected_msgs[] = $row[0]; |
|
| 1426 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1427 | + $affected_msgs[] = $row[0]; |
|
| 1428 | + } |
|
| 1358 | 1429 | $smcFunc['db_free_result']($request); |
| 1359 | 1430 | |
| 1360 | 1431 | // Assign the first topic ID to be the merged topic. |
@@ -1432,9 +1503,9 @@ discard block |
||
| 1432 | 1503 | // Grab the response prefix (like 'Re: ') in the default forum language. |
| 1433 | 1504 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) |
| 1434 | 1505 | { |
| 1435 | - if ($language === $user_info['language']) |
|
| 1436 | - $context['response_prefix'] = $txt['response_prefix']; |
|
| 1437 | - else |
|
| 1506 | + if ($language === $user_info['language']) { |
|
| 1507 | + $context['response_prefix'] = $txt['response_prefix']; |
|
| 1508 | + } else |
|
| 1438 | 1509 | { |
| 1439 | 1510 | loadLanguage('index', $language, false); |
| 1440 | 1511 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -1514,8 +1585,9 @@ discard block |
||
| 1514 | 1585 | if ($smcFunc['db_num_rows']($request) > 0) |
| 1515 | 1586 | { |
| 1516 | 1587 | $replaceEntries = array(); |
| 1517 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1518 | - $replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']); |
|
| 1588 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1589 | + $replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']); |
|
| 1590 | + } |
|
| 1519 | 1591 | |
| 1520 | 1592 | $smcFunc['db_insert']('replace', |
| 1521 | 1593 | '{db_prefix}log_topics', |
@@ -1552,8 +1624,9 @@ discard block |
||
| 1552 | 1624 | if ($smcFunc['db_num_rows']($request) > 0) |
| 1553 | 1625 | { |
| 1554 | 1626 | $replaceEntries = array(); |
| 1555 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1556 | - $replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']); |
|
| 1627 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1628 | + $replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']); |
|
| 1629 | + } |
|
| 1557 | 1630 | |
| 1558 | 1631 | $smcFunc['db_insert']('replace', |
| 1559 | 1632 | '{db_prefix}log_notify', |
@@ -1728,8 +1801,9 @@ discard block |
||
| 1728 | 1801 | // If there's a search index that needs updating, update it... |
| 1729 | 1802 | require_once($sourcedir . '/Search.php'); |
| 1730 | 1803 | $searchAPI = findSearchAPI(); |
| 1731 | - if (is_callable(array($searchAPI, 'topicMerge'))) |
|
| 1732 | - $searchAPI->topicMerge($id_topic, $topics, $affected_msgs, empty($_POST['enforce_subject']) ? null : array($context['response_prefix'], $target_subject)); |
|
| 1804 | + if (is_callable(array($searchAPI, 'topicMerge'))) { |
|
| 1805 | + $searchAPI->topicMerge($id_topic, $topics, $affected_msgs, empty($_POST['enforce_subject']) ? null : array($context['response_prefix'], $target_subject)); |
|
| 1806 | + } |
|
| 1733 | 1807 | |
| 1734 | 1808 | // Merging is the sort of thing an external CMS might want to know about |
| 1735 | 1809 | $merged_topic = array( |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | class CreatePost_Notify_Background extends SMF_BackgroundTask |
| 19 | 19 | { |
| 20 | 20 | /** |
| 21 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 21 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 22 | 22 | * @return bool Always returns true |
| 23 | 23 | */ |
| 24 | 24 | public function execute() |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | 108 | if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
| 109 | - continue; |
|
| 109 | + continue; |
|
| 110 | 110 | if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
| 111 | 111 | continue; |
| 112 | 112 | elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
@@ -73,8 +73,9 @@ discard block |
||
| 73 | 73 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 74 | 74 | { |
| 75 | 75 | $groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups']))); |
| 76 | - if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) |
|
| 77 | - continue; |
|
| 76 | + if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) { |
|
| 77 | + continue; |
|
| 78 | + } |
|
| 78 | 79 | |
| 79 | 80 | $members[] = $row['id_member']; |
| 80 | 81 | $watched[$row['id_member']] = $row; |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $smcFunc['db_free_result']($request); |
| 84 | 85 | |
| 85 | - if (empty($members)) |
|
| 86 | - return true; |
|
| 86 | + if (empty($members)) { |
|
| 87 | + return true; |
|
| 88 | + } |
|
| 87 | 89 | |
| 88 | 90 | $members = array_unique($members); |
| 89 | 91 | $prefs = getNotifyPrefs($members, '', true); |
@@ -105,20 +107,23 @@ discard block |
||
| 105 | 107 | $notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1; |
| 106 | 108 | |
| 107 | 109 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | - if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
|
| 109 | - continue; |
|
| 110 | - if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
|
| 111 | - continue; |
|
| 112 | - elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
|
| 113 | - continue; |
|
| 114 | - elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) |
|
| 115 | - continue; |
|
| 116 | - elseif ($notify_types == 4) |
|
| 117 | - continue; |
|
| 110 | + if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) { |
|
| 111 | + continue; |
|
| 112 | + } |
|
| 113 | + if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) { |
|
| 114 | + continue; |
|
| 115 | + } elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) { |
|
| 116 | + continue; |
|
| 117 | + } elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) { |
|
| 118 | + continue; |
|
| 119 | + } elseif ($notify_types == 4) { |
|
| 120 | + continue; |
|
| 121 | + } |
|
| 118 | 122 | |
| 119 | 123 | if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members) |
| 120 | - || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) |
|
| 121 | - continue; |
|
| 124 | + || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) { |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 122 | 127 | |
| 123 | 128 | // Watched topic? |
| 124 | 129 | if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member])) |
@@ -128,10 +133,12 @@ discard block |
||
| 128 | 133 | |
| 129 | 134 | if ($type == 'reply') |
| 130 | 135 | { |
| 131 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 132 | - $message_type .= '_body'; |
|
| 133 | - if (!empty($frequency)) |
|
| 134 | - $message_type .= '_once'; |
|
| 136 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 137 | + $message_type .= '_body'; |
|
| 138 | + } |
|
| 139 | + if (!empty($frequency)) { |
|
| 140 | + $message_type .= '_once'; |
|
| 141 | + } |
|
| 135 | 142 | } |
| 136 | 143 | |
| 137 | 144 | $content_type = 'topic'; |
@@ -144,12 +151,14 @@ discard block |
||
| 144 | 151 | $content_type = 'board'; |
| 145 | 152 | |
| 146 | 153 | $message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards'; |
| 147 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 148 | - $message_type .= '_body'; |
|
| 154 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 155 | + $message_type .= '_body'; |
|
| 156 | + } |
|
| 149 | 157 | } |
| 150 | 158 | // If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip |
| 151 | - else |
|
| 152 | - continue; |
|
| 159 | + else { |
|
| 160 | + continue; |
|
| 161 | + } |
|
| 153 | 162 | |
| 154 | 163 | if ($pref & 0x02) |
| 155 | 164 | { |
@@ -212,14 +221,15 @@ discard block |
||
| 212 | 221 | ); |
| 213 | 222 | |
| 214 | 223 | // Insert the alerts if any |
| 215 | - if (!empty($alert_rows)) |
|
| 216 | - $smcFunc['db_insert']('', |
|
| 224 | + if (!empty($alert_rows)) { |
|
| 225 | + $smcFunc['db_insert']('', |
|
| 217 | 226 | '{db_prefix}user_alerts', |
| 218 | 227 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 219 | 228 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 220 | 229 | $alert_rows, |
| 221 | 230 | array() |
| 222 | 231 | ); |
| 232 | + } |
|
| 223 | 233 | |
| 224 | 234 | return true; |
| 225 | 235 | } |
@@ -230,8 +240,9 @@ discard block |
||
| 230 | 240 | |
| 231 | 241 | foreach ($quotedMembers as $id => $member) |
| 232 | 242 | { |
| 233 | - if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) |
|
| 234 | - continue; |
|
| 243 | + if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) { |
|
| 244 | + continue; |
|
| 245 | + } |
|
| 235 | 246 | |
| 236 | 247 | $done_members[] = $id; |
| 237 | 248 | |
@@ -283,32 +294,35 @@ discard block |
||
| 283 | 294 | { |
| 284 | 295 | if (preg_match('/\[quote(.*)?\]/i', $block, $matches)) |
| 285 | 296 | { |
| 286 | - if ($quote_level == 0) |
|
| 287 | - $message .= '[quote' . $matches[1] . ']'; |
|
| 297 | + if ($quote_level == 0) { |
|
| 298 | + $message .= '[quote' . $matches[1] . ']'; |
|
| 299 | + } |
|
| 288 | 300 | $quote_level++; |
| 289 | - } |
|
| 290 | - elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 301 | + } elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 291 | 302 | { |
| 292 | - if ($quote_level <= 1) |
|
| 293 | - $message .= '[/quote]'; |
|
| 303 | + if ($quote_level <= 1) { |
|
| 304 | + $message .= '[/quote]'; |
|
| 305 | + } |
|
| 294 | 306 | if ($quote_level >= 1) |
| 295 | 307 | { |
| 296 | 308 | $quote_level--; |
| 297 | 309 | $message .= "\n"; |
| 298 | 310 | } |
| 311 | + } elseif ($quote_level <= 1) { |
|
| 312 | + $message .= $block; |
|
| 299 | 313 | } |
| 300 | - elseif ($quote_level <= 1) |
|
| 301 | - $message .= $block; |
|
| 302 | 314 | } |
| 303 | 315 | |
| 304 | 316 | preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches); |
| 305 | 317 | |
| 306 | 318 | $id_msgs = $matches[1]; |
| 307 | - foreach ($id_msgs as $k => $id_msg) |
|
| 308 | - $id_msgs[$k] = (int) $id_msg; |
|
| 319 | + foreach ($id_msgs as $k => $id_msg) { |
|
| 320 | + $id_msgs[$k] = (int) $id_msg; |
|
| 321 | + } |
|
| 309 | 322 | |
| 310 | - if (empty($id_msgs)) |
|
| 311 | - return array(); |
|
| 323 | + if (empty($id_msgs)) { |
|
| 324 | + return array(); |
|
| 325 | + } |
|
| 312 | 326 | |
| 313 | 327 | // Get the messages |
| 314 | 328 | $request = $smcFunc['db_query']('', ' |
@@ -326,8 +340,9 @@ discard block |
||
| 326 | 340 | $members = array(); |
| 327 | 341 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 328 | 342 | { |
| 329 | - if ($posterOptions['id'] == $row['id_member']) |
|
| 330 | - continue; |
|
| 343 | + if ($posterOptions['id'] == $row['id_member']) { |
|
| 344 | + continue; |
|
| 345 | + } |
|
| 331 | 346 | |
| 332 | 347 | $members[$row['id_member']] = $row; |
| 333 | 348 | } |
@@ -341,10 +356,11 @@ discard block |
||
| 341 | 356 | |
| 342 | 357 | foreach ($members as $id => $member) |
| 343 | 358 | { |
| 344 | - if (!empty($prefs[$id]['msg_mention'])) |
|
| 345 | - $done_members[] = $id; |
|
| 346 | - else |
|
| 347 | - continue; |
|
| 359 | + if (!empty($prefs[$id]['msg_mention'])) { |
|
| 360 | + $done_members[] = $id; |
|
| 361 | + } else { |
|
| 362 | + continue; |
|
| 363 | + } |
|
| 348 | 364 | |
| 349 | 365 | // Alerts' emails are always instant |
| 350 | 366 | if ($prefs[$id]['msg_mention'] & 0x02) |
@@ -51,30 +51,33 @@ discard block |
||
| 51 | 51 | $ignored_members = explode(',', $row['pm_ignore_list']); |
| 52 | 52 | |
| 53 | 53 | // If the user is in group 1 anywhere, they can see everything anyway. |
| 54 | - if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) |
|
| 55 | - $author = $row['id_member']; |
|
| 54 | + if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) { |
|
| 55 | + $author = $row['id_member']; |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | $smcFunc['db_free_result']($request); |
| 58 | - } |
|
| 59 | - else |
|
| 59 | + } else |
|
| 60 | 60 | { |
| 61 | 61 | // This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id. |
| 62 | 62 | $hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id'])); |
| 63 | - foreach ($hook_results as $result) |
|
| 64 | - if (!empty($result)) |
|
| 63 | + foreach ($hook_results as $result) { |
|
| 64 | + if (!empty($result)) |
|
| 65 | 65 | { |
| 66 | 66 | $author = $result; |
| 67 | + } |
|
| 67 | 68 | break; |
| 68 | 69 | } |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | // If we didn't have a member... leave. |
| 72 | - if (empty($author)) |
|
| 73 | - return true; |
|
| 73 | + if (empty($author)) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // If the person who sent the notification is the person whose content it is, do nothing. |
| 76 | - if ($author == $this->_details['sender_id']) |
|
| 77 | - return true; |
|
| 78 | + if ($author == $this->_details['sender_id']) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | // If the person who sent the notification is on this person's ignore list, do nothing. |
| 80 | 83 | if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) { |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | // As a result, the value should really just be non empty. |
| 89 | 92 | |
| 90 | 93 | // Check the value. If no value or it's empty, they didn't want alerts, oh well. |
| 91 | - if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) |
|
| 92 | - return true; |
|
| 94 | + if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | // Don't spam the alerts: if there is an existing unread alert of the |
| 95 | 99 | // requested type for the target user from the sender, don't make a new one. |
@@ -109,8 +113,9 @@ discard block |
||
| 109 | 113 | ) |
| 110 | 114 | ); |
| 111 | 115 | |
| 112 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 113 | - return true; |
|
| 116 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 114 | 119 | $smcFunc['db_free_result']($request); |
| 115 | 120 | |
| 116 | 121 | // Issue, update, move on. |
@@ -670,7 +670,7 @@ |
||
| 670 | 670 | // Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified! |
| 671 | 671 | // Because we insert into it through AJAX and we don't want to stop themers moving it around if they so wish so they can put it where they want it. |
| 672 | 672 | echo ' |
| 673 | - <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
|
| 673 | + <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '', '" id="modified_', $message['id'], '">'; |
|
| 674 | 674 | |
| 675 | 675 | if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
| 676 | 676 | echo |
@@ -18,18 +18,20 @@ discard block |
||
| 18 | 18 | global $context, $settings, $options, $txt, $scripturl, $modSettings; |
| 19 | 19 | |
| 20 | 20 | // Let them know, if their report was a success! |
| 21 | - if ($context['report_sent']) |
|
| 22 | - echo ' |
|
| 21 | + if ($context['report_sent']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <div class="infobox"> |
| 24 | 24 | ', $txt['report_sent'], ' |
| 25 | 25 | </div>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // Let them know why their message became unapproved. |
| 28 | - if ($context['becomesUnapproved']) |
|
| 29 | - echo ' |
|
| 29 | + if ($context['becomesUnapproved']) { |
|
| 30 | + echo ' |
|
| 30 | 31 | <div class="noticebox"> |
| 31 | 32 | ', $txt['post_becomesUnapproved'], ' |
| 32 | 33 | </div>'; |
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | // Show new topic info here? |
| 35 | 37 | echo ' |
@@ -49,11 +51,13 @@ discard block |
||
| 49 | 51 | <p>'; |
| 50 | 52 | |
| 51 | 53 | // Show just numbers...? |
| 52 | - if ($settings['display_who_viewing'] == 1) |
|
| 53 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 54 | + if ($settings['display_who_viewing'] == 1) { |
|
| 55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 56 | + } |
|
| 54 | 57 | // Or show the actual people viewing the topic? |
| 55 | - else |
|
| 56 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 58 | + else { |
|
| 59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | // Now show how many guests are here too. |
| 59 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -91,10 +95,11 @@ discard block |
||
| 91 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
| 92 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
| 93 | 97 | |
| 94 | - if ($context['allow_results_view']) |
|
| 95 | - echo ' |
|
| 98 | + if ($context['allow_results_view']) { |
|
| 99 | + echo ' |
|
| 96 | 100 | ', $option['bar_ndt'], ' |
| 97 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
| 102 | + } |
|
| 98 | 103 | |
| 99 | 104 | echo ' |
| 100 | 105 | </dd>'; |
@@ -103,9 +108,10 @@ discard block |
||
| 103 | 108 | echo ' |
| 104 | 109 | </dl>'; |
| 105 | 110 | |
| 106 | - if ($context['allow_results_view']) |
|
| 107 | - echo ' |
|
| 111 | + if ($context['allow_results_view']) { |
|
| 112 | + echo ' |
|
| 108 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
| 114 | + } |
|
| 109 | 115 | } |
| 110 | 116 | // They are allowed to vote! Go to it! |
| 111 | 117 | else |
@@ -114,17 +120,19 @@ discard block |
||
| 114 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
| 115 | 121 | |
| 116 | 122 | // Show a warning if they are allowed more than one option. |
| 117 | - if ($context['poll']['allowed_warning']) |
|
| 118 | - echo ' |
|
| 123 | + if ($context['poll']['allowed_warning']) { |
|
| 124 | + echo ' |
|
| 119 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
| 126 | + } |
|
| 120 | 127 | |
| 121 | 128 | echo ' |
| 122 | 129 | <ul class="options">'; |
| 123 | 130 | |
| 124 | 131 | // Show each option with its button - a radio likely. |
| 125 | - foreach ($context['poll']['options'] as $option) |
|
| 126 | - echo ' |
|
| 132 | + foreach ($context['poll']['options'] as $option) { |
|
| 133 | + echo ' |
|
| 127 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
| 135 | + } |
|
| 128 | 136 | |
| 129 | 137 | echo ' |
| 130 | 138 | </ul> |
@@ -136,9 +144,10 @@ discard block |
||
| 136 | 144 | } |
| 137 | 145 | |
| 138 | 146 | // Is the clock ticking? |
| 139 | - if (!empty($context['poll']['expire_time'])) |
|
| 140 | - echo ' |
|
| 147 | + if (!empty($context['poll']['expire_time'])) { |
|
| 148 | + echo ' |
|
| 141 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
| 150 | + } |
|
| 142 | 151 | |
| 143 | 152 | echo ' |
| 144 | 153 | </div><!-- #poll_options --> |
@@ -168,11 +177,13 @@ discard block |
||
| 168 | 177 | <li> |
| 169 | 178 | <strong class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></strong>'; |
| 170 | 179 | |
| 171 | - if ($event['can_edit']) |
|
| 172 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 180 | + if ($event['can_edit']) { |
|
| 181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 182 | + } |
|
| 173 | 183 | |
| 174 | - if ($event['can_export']) |
|
| 175 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 184 | + if ($event['can_export']) { |
|
| 185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 186 | + } |
|
| 176 | 187 | |
| 177 | 188 | echo ' |
| 178 | 189 | <br>'; |
@@ -180,14 +191,14 @@ discard block |
||
| 180 | 191 | if (!empty($event['allday'])) |
| 181 | 192 | { |
| 182 | 193 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
| 183 | - } |
|
| 184 | - else |
|
| 194 | + } else |
|
| 185 | 195 | { |
| 186 | 196 | // Display event info relative to user's local timezone |
| 187 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 188 | 198 | |
| 189 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
| 190 | - echo trim($event['end_date_local']) . ', '; |
|
| 199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
| 200 | + echo trim($event['end_date_local']) . ', '; |
|
| 201 | + } |
|
| 191 | 202 | |
| 192 | 203 | echo trim($event['end_time_local']); |
| 193 | 204 | |
@@ -196,24 +207,28 @@ discard block |
||
| 196 | 207 | { |
| 197 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
| 198 | 209 | |
| 199 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
| 200 | - echo trim($event['start_date_orig']), ', '; |
|
| 210 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
| 211 | + echo trim($event['start_date_orig']), ', '; |
|
| 212 | + } |
|
| 201 | 213 | |
| 202 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 203 | 215 | |
| 204 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
| 205 | - echo trim($event['end_date_orig']) . ', '; |
|
| 216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
| 217 | + echo trim($event['end_date_orig']) . ', '; |
|
| 218 | + } |
|
| 206 | 219 | |
| 207 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
| 208 | 221 | } |
| 209 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
| 210 | - else |
|
| 211 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 223 | + else { |
|
| 224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 225 | + } |
|
| 212 | 226 | } |
| 213 | 227 | |
| 214 | - if (!empty($event['location'])) |
|
| 215 | - echo ' |
|
| 228 | + if (!empty($event['location'])) { |
|
| 229 | + echo ' |
|
| 216 | 230 | <br>', $event['location']; |
| 231 | + } |
|
| 217 | 232 | |
| 218 | 233 | echo ' |
| 219 | 234 | </li>'; |
@@ -250,8 +265,9 @@ discard block |
||
| 250 | 265 | $context['removableMessageIDs'] = array(); |
| 251 | 266 | |
| 252 | 267 | // Get all the messages... |
| 253 | - while ($message = $context['get_message']()) |
|
| 254 | - template_single_post($message); |
|
| 268 | + while ($message = $context['get_message']()) { |
|
| 269 | + template_single_post($message); |
|
| 270 | + } |
|
| 255 | 271 | |
| 256 | 272 | echo ' |
| 257 | 273 | </form> |
@@ -289,8 +305,9 @@ discard block |
||
| 289 | 305 | <div id="display_jump_to"></div>'; |
| 290 | 306 | |
| 291 | 307 | // Show quickreply |
| 292 | - if ($context['can_reply']) |
|
| 293 | - template_quickreply(); |
|
| 308 | + if ($context['can_reply']) { |
|
| 309 | + template_quickreply(); |
|
| 310 | + } |
|
| 294 | 311 | |
| 295 | 312 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 296 | 313 | echo ' |
@@ -305,8 +322,8 @@ discard block |
||
| 305 | 322 | </div>'; |
| 306 | 323 | |
| 307 | 324 | // Show the moderation button & pop only if user can moderate |
| 308 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 309 | - echo ' |
|
| 325 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 326 | + echo ' |
|
| 310 | 327 | <div id="mobile_moderation" class="popup_container"> |
| 311 | 328 | <div class="popup_window description"> |
| 312 | 329 | <div class="popup_heading"> |
@@ -318,6 +335,7 @@ discard block |
||
| 318 | 335 | </div> |
| 319 | 336 | </div> |
| 320 | 337 | </div>'; |
| 338 | + } |
|
| 321 | 339 | |
| 322 | 340 | echo ' |
| 323 | 341 | <script>'; |
@@ -441,9 +459,10 @@ discard block |
||
| 441 | 459 | }); |
| 442 | 460 | }'; |
| 443 | 461 | |
| 444 | - if (!empty($context['ignoredMsgs'])) |
|
| 445 | - echo ' |
|
| 462 | + if (!empty($context['ignoredMsgs'])) { |
|
| 463 | + echo ' |
|
| 446 | 464 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 465 | + } |
|
| 447 | 466 | |
| 448 | 467 | echo ' |
| 449 | 468 | </script>'; |
@@ -460,8 +479,9 @@ discard block |
||
| 460 | 479 | |
| 461 | 480 | $ignoring = false; |
| 462 | 481 | |
| 463 | - if ($message['can_remove']) |
|
| 464 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 482 | + if ($message['can_remove']) { |
|
| 483 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 484 | + } |
|
| 465 | 485 | |
| 466 | 486 | // Are we ignoring this message? |
| 467 | 487 | if (!empty($message['is_ignored'])) |
@@ -488,9 +508,10 @@ discard block |
||
| 488 | 508 | <div class="custom_fields_above_member"> |
| 489 | 509 | <ul class="nolist">'; |
| 490 | 510 | |
| 491 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 492 | - echo ' |
|
| 511 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 512 | + echo ' |
|
| 493 | 513 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 514 | + } |
|
| 494 | 515 | |
| 495 | 516 | echo ' |
| 496 | 517 | </ul> |
@@ -501,25 +522,28 @@ discard block |
||
| 501 | 522 | <h4>'; |
| 502 | 523 | |
| 503 | 524 | // Show online and offline buttons? |
| 504 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 505 | - echo ' |
|
| 525 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 526 | + echo ' |
|
| 506 | 527 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
| 528 | + } |
|
| 507 | 529 | |
| 508 | 530 | // Custom fields BEFORE the username? |
| 509 | - if (!empty($message['custom_fields']['before_member'])) |
|
| 510 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 531 | + if (!empty($message['custom_fields']['before_member'])) { |
|
| 532 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
| 511 | 533 | echo ' |
| 512 | 534 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 535 | + } |
|
| 513 | 536 | |
| 514 | 537 | // Show a link to the member's profile. |
| 515 | 538 | echo ' |
| 516 | 539 | ', $message['member']['link']; |
| 517 | 540 | |
| 518 | 541 | // Custom fields AFTER the username? |
| 519 | - if (!empty($message['custom_fields']['after_member'])) |
|
| 520 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 542 | + if (!empty($message['custom_fields']['after_member'])) { |
|
| 543 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
| 521 | 544 | echo ' |
| 522 | 545 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
| 546 | + } |
|
| 523 | 547 | |
| 524 | 548 | // Begin display of user info |
| 525 | 549 | echo ' |
@@ -527,51 +551,59 @@ discard block |
||
| 527 | 551 | <ul class="user_info">'; |
| 528 | 552 | |
| 529 | 553 | // Show the user's avatar. |
| 530 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 531 | - echo ' |
|
| 554 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 555 | + echo ' |
|
| 532 | 556 | <li class="avatar"> |
| 533 | 557 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 534 | 558 | </li>'; |
| 559 | + } |
|
| 535 | 560 | |
| 536 | 561 | // Are there any custom fields below the avatar? |
| 537 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 538 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 562 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 563 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 539 | 564 | echo ' |
| 540 | 565 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 566 | + } |
|
| 541 | 567 | |
| 542 | 568 | // Show the post group icons, but not for guests. |
| 543 | - if (!$message['member']['is_guest']) |
|
| 544 | - echo ' |
|
| 569 | + if (!$message['member']['is_guest']) { |
|
| 570 | + echo ' |
|
| 545 | 571 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 572 | + } |
|
| 546 | 573 | |
| 547 | 574 | // Show the member's primary group (like 'Administrator') if they have one. |
| 548 | - if (!empty($message['member']['group'])) |
|
| 549 | - echo ' |
|
| 575 | + if (!empty($message['member']['group'])) { |
|
| 576 | + echo ' |
|
| 550 | 577 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 578 | + } |
|
| 551 | 579 | |
| 552 | 580 | // Show the member's custom title, if they have one. |
| 553 | - if (!empty($message['member']['title'])) |
|
| 554 | - echo ' |
|
| 581 | + if (!empty($message['member']['title'])) { |
|
| 582 | + echo ' |
|
| 555 | 583 | <li class="title">', $message['member']['title'], '</li>'; |
| 584 | + } |
|
| 556 | 585 | |
| 557 | 586 | // Don't show these things for guests. |
| 558 | 587 | if (!$message['member']['is_guest']) |
| 559 | 588 | { |
| 560 | 589 | |
| 561 | 590 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 562 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 563 | - echo ' |
|
| 591 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 592 | + echo ' |
|
| 564 | 593 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 594 | + } |
|
| 565 | 595 | |
| 566 | 596 | // Show how many posts they have made. |
| 567 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 568 | - echo ' |
|
| 597 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 598 | + echo ' |
|
| 569 | 599 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 600 | + } |
|
| 570 | 601 | |
| 571 | 602 | // Show their personal text? |
| 572 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 573 | - echo ' |
|
| 603 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 604 | + echo ' |
|
| 574 | 605 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 606 | + } |
|
| 575 | 607 | |
| 576 | 608 | // Any custom fields to show as icons? |
| 577 | 609 | if (!empty($message['custom_fields']['icons'])) |
@@ -580,9 +612,10 @@ discard block |
||
| 580 | 612 | <li class="im_icons"> |
| 581 | 613 | <ol>'; |
| 582 | 614 | |
| 583 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 584 | - echo ' |
|
| 615 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 616 | + echo ' |
|
| 585 | 617 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 618 | + } |
|
| 586 | 619 | |
| 587 | 620 | echo ' |
| 588 | 621 | </ol> |
@@ -597,19 +630,22 @@ discard block |
||
| 597 | 630 | <ol class="profile_icons">'; |
| 598 | 631 | |
| 599 | 632 | // Don't show an icon if they haven't specified a website. |
| 600 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 601 | - echo ' |
|
| 633 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 634 | + echo ' |
|
| 602 | 635 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 636 | + } |
|
| 603 | 637 | |
| 604 | 638 | // Since we know this person isn't a guest, you *can* message them. |
| 605 | - if ($context['can_send_pm']) |
|
| 606 | - echo ' |
|
| 639 | + if ($context['can_send_pm']) { |
|
| 640 | + echo ' |
|
| 607 | 641 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 642 | + } |
|
| 608 | 643 | |
| 609 | 644 | // Show the email if necessary |
| 610 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 611 | - echo ' |
|
| 645 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 646 | + echo ' |
|
| 612 | 647 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 648 | + } |
|
| 613 | 649 | |
| 614 | 650 | echo ' |
| 615 | 651 | </ol> |
@@ -617,58 +653,66 @@ discard block |
||
| 617 | 653 | } |
| 618 | 654 | |
| 619 | 655 | // Any custom fields for standard placement? |
| 620 | - if (!empty($message['custom_fields']['standard'])) |
|
| 621 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 656 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 657 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 622 | 658 | echo ' |
| 623 | 659 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 660 | + } |
|
| 624 | 661 | |
| 625 | 662 | } |
| 626 | 663 | // Otherwise, show the guest's email. |
| 627 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 628 | - echo ' |
|
| 664 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 665 | + echo ' |
|
| 629 | 666 | <li class="email"> |
| 630 | 667 | <a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a> |
| 631 | 668 | </li>'; |
| 669 | + } |
|
| 632 | 670 | |
| 633 | 671 | // Show the IP to this user for this post - because you can moderate? |
| 634 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 635 | - echo ' |
|
| 672 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 673 | + echo ' |
|
| 636 | 674 | <li class="poster_ip"> |
| 637 | 675 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
| 638 | 676 | </li>'; |
| 677 | + } |
|
| 639 | 678 | |
| 640 | 679 | // Or, should we show it because this is you? |
| 641 | - elseif ($message['can_see_ip']) |
|
| 642 | - echo ' |
|
| 680 | + elseif ($message['can_see_ip']) { |
|
| 681 | + echo ' |
|
| 643 | 682 | <li class="poster_ip"> |
| 644 | 683 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
| 645 | 684 | </li>'; |
| 685 | + } |
|
| 646 | 686 | |
| 647 | 687 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 648 | - elseif (!$context['user']['is_guest']) |
|
| 649 | - echo ' |
|
| 688 | + elseif (!$context['user']['is_guest']) { |
|
| 689 | + echo ' |
|
| 650 | 690 | <li class="poster_ip"> |
| 651 | 691 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
| 652 | 692 | </li>'; |
| 693 | + } |
|
| 653 | 694 | |
| 654 | 695 | // Otherwise, you see NOTHING! |
| 655 | - else |
|
| 656 | - echo ' |
|
| 696 | + else { |
|
| 697 | + echo ' |
|
| 657 | 698 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 699 | + } |
|
| 658 | 700 | |
| 659 | 701 | // Are we showing the warning status? |
| 660 | 702 | // Don't show these things for guests. |
| 661 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 662 | - echo ' |
|
| 703 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 704 | + echo ' |
|
| 663 | 705 | <li class="warning"> |
| 664 | 706 | ', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span> |
| 665 | 707 | </li>'; |
| 708 | + } |
|
| 666 | 709 | |
| 667 | 710 | // Are there any custom fields to show at the bottom of the poster info? |
| 668 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 669 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 711 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 712 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 670 | 713 | echo ' |
| 671 | 714 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 715 | + } |
|
| 672 | 716 | |
| 673 | 717 | // Poster info ends. |
| 674 | 718 | echo ' |
@@ -698,9 +742,10 @@ discard block |
||
| 698 | 742 | echo ' |
| 699 | 743 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
| 700 | 744 | |
| 701 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 702 | - echo |
|
| 745 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 746 | + echo |
|
| 703 | 747 | $message['modified']['last_edit_text']; |
| 748 | + } |
|
| 704 | 749 | |
| 705 | 750 | echo ' |
| 706 | 751 | </span> |
@@ -709,22 +754,24 @@ discard block |
||
| 709 | 754 | </div><!-- .keyinfo -->'; |
| 710 | 755 | |
| 711 | 756 | // Ignoring this user? Hide the post. |
| 712 | - if ($ignoring) |
|
| 713 | - echo ' |
|
| 757 | + if ($ignoring) { |
|
| 758 | + echo ' |
|
| 714 | 759 | <div id="msg_', $message['id'], '_ignored_prompt"> |
| 715 | 760 | ', $txt['ignoring_user'], ' |
| 716 | 761 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
| 717 | 762 | </div>'; |
| 763 | + } |
|
| 718 | 764 | |
| 719 | 765 | // Show the post itself, finally! |
| 720 | 766 | echo ' |
| 721 | 767 | <div class="post">'; |
| 722 | 768 | |
| 723 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
| 724 | - echo ' |
|
| 769 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
| 770 | + echo ' |
|
| 725 | 771 | <div class="approve_post"> |
| 726 | 772 | ', $txt['post_awaiting_approval'], ' |
| 727 | 773 | </div>'; |
| 774 | + } |
|
| 728 | 775 | echo ' |
| 729 | 776 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '> |
| 730 | 777 | ', $message['body'], ' |
@@ -743,9 +790,9 @@ discard block |
||
| 743 | 790 | foreach ($message['attachment'] as $attachment) |
| 744 | 791 | { |
| 745 | 792 | // Do we want this attachment to not be showed here? |
| 746 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
| 747 | - continue; |
|
| 748 | - elseif (!$div_output) |
|
| 793 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
| 794 | + continue; |
|
| 795 | + } elseif (!$div_output) |
|
| 749 | 796 | { |
| 750 | 797 | $div_output = true; |
| 751 | 798 | |
@@ -762,9 +809,10 @@ discard block |
||
| 762 | 809 | <legend> |
| 763 | 810 | ', $txt['attach_awaiting_approve']; |
| 764 | 811 | |
| 765 | - if ($context['can_approve']) |
|
| 766 | - echo ' |
|
| 812 | + if ($context['can_approve']) { |
|
| 813 | + echo ' |
|
| 767 | 814 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
| 815 | + } |
|
| 768 | 816 | |
| 769 | 817 | echo ' |
| 770 | 818 | </legend>'; |
@@ -778,12 +826,13 @@ discard block |
||
| 778 | 826 | echo ' |
| 779 | 827 | <div class="attachments_top">'; |
| 780 | 828 | |
| 781 | - if ($attachment['thumbnail']['has_thumb']) |
|
| 782 | - echo ' |
|
| 829 | + if ($attachment['thumbnail']['has_thumb']) { |
|
| 830 | + echo ' |
|
| 783 | 831 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
| 784 | - else |
|
| 785 | - echo ' |
|
| 832 | + } else { |
|
| 833 | + echo ' |
|
| 786 | 834 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
| 835 | + } |
|
| 787 | 836 | |
| 788 | 837 | echo ' |
| 789 | 838 | </div><!-- .attachments_top -->'; |
@@ -793,9 +842,10 @@ discard block |
||
| 793 | 842 | <div class="attachments_bot"> |
| 794 | 843 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
| 795 | 844 | |
| 796 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
| 797 | - echo ' |
|
| 845 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
| 846 | + echo ' |
|
| 798 | 847 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
| 848 | + } |
|
| 799 | 849 | echo ' |
| 800 | 850 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
| 801 | 851 | </div><!-- .attachments_bot -->'; |
@@ -804,35 +854,40 @@ discard block |
||
| 804 | 854 | </div><!-- .attached -->'; |
| 805 | 855 | |
| 806 | 856 | // Next attachment line ? |
| 807 | - if (++$i % $attachments_per_line === 0) |
|
| 808 | - echo ' |
|
| 857 | + if (++$i % $attachments_per_line === 0) { |
|
| 858 | + echo ' |
|
| 809 | 859 | <br>'; |
| 860 | + } |
|
| 810 | 861 | } |
| 811 | 862 | |
| 812 | 863 | // If we had unapproved attachments clean up. |
| 813 | - if ($last_approved_state == 0) |
|
| 814 | - echo ' |
|
| 864 | + if ($last_approved_state == 0) { |
|
| 865 | + echo ' |
|
| 815 | 866 | </fieldset>'; |
| 867 | + } |
|
| 816 | 868 | |
| 817 | 869 | // Only do this if we output a div above - otherwise it'll break things |
| 818 | - if ($div_output) |
|
| 819 | - echo ' |
|
| 870 | + if ($div_output) { |
|
| 871 | + echo ' |
|
| 820 | 872 | </div><!-- #msg_[id]_footer -->'; |
| 873 | + } |
|
| 821 | 874 | } |
| 822 | 875 | |
| 823 | 876 | // And stuff below the attachments. |
| 824 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 825 | - echo ' |
|
| 877 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 878 | + echo ' |
|
| 826 | 879 | <div class="under_message">'; |
| 880 | + } |
|
| 827 | 881 | |
| 828 | 882 | // Maybe they want to report this post to the moderator(s)? |
| 829 | - if ($context['can_report_moderator']) |
|
| 830 | - echo ' |
|
| 883 | + if ($context['can_report_moderator']) { |
|
| 884 | + echo ' |
|
| 831 | 885 | <ul class="floatright smalltext"> |
| 832 | 886 | <li class="report_link"> |
| 833 | 887 | <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> |
| 834 | 888 | </li> |
| 835 | 889 | </ul>'; |
| 890 | + } |
|
| 836 | 891 | |
| 837 | 892 | // What about likes? |
| 838 | 893 | if (!empty($modSettings['enable_likes'])) |
@@ -879,83 +934,95 @@ discard block |
||
| 879 | 934 | <ul class="quickbuttons">'; |
| 880 | 935 | |
| 881 | 936 | // Can they quote? if so they can select and quote as well! |
| 882 | - if ($context['can_quote']) |
|
| 883 | - echo ' |
|
| 937 | + if ($context['can_quote']) { |
|
| 938 | + echo ' |
|
| 884 | 939 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
| 885 | 940 | <li style="display:none;" id="quoteSelected_', $message['id'], '"> |
| 886 | 941 | <a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a> |
| 887 | 942 | </li>'; |
| 943 | + } |
|
| 888 | 944 | |
| 889 | 945 | // Can the user modify the contents of this post? Show the modify inline image. |
| 890 | - if ($message['can_modify']) |
|
| 891 | - echo ' |
|
| 946 | + if ($message['can_modify']) { |
|
| 947 | + echo ' |
|
| 892 | 948 | <li class="quick_edit"> |
| 893 | 949 | <a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a> |
| 894 | 950 | </li>'; |
| 951 | + } |
|
| 895 | 952 | |
| 896 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 897 | - echo ' |
|
| 953 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 954 | + echo ' |
|
| 898 | 955 | <li class="post_options">', $txt['post_options']; |
| 956 | + } |
|
| 899 | 957 | |
| 900 | 958 | echo ' |
| 901 | 959 | <ul>'; |
| 902 | 960 | |
| 903 | 961 | // Can the user modify the contents of this post? |
| 904 | - if ($message['can_modify']) |
|
| 905 | - echo ' |
|
| 962 | + if ($message['can_modify']) { |
|
| 963 | + echo ' |
|
| 906 | 964 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
| 965 | + } |
|
| 907 | 966 | |
| 908 | 967 | // How about... even... remove it entirely?! |
| 909 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
| 910 | - echo ' |
|
| 968 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
| 969 | + echo ' |
|
| 911 | 970 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
| 912 | - |
|
| 913 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
| 914 | - echo ' |
|
| 971 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
| 972 | + echo ' |
|
| 915 | 973 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 974 | + } |
|
| 916 | 975 | |
| 917 | 976 | // What about splitting it off the rest of the topic? |
| 918 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
| 919 | - echo ' |
|
| 977 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
| 978 | + echo ' |
|
| 920 | 979 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
| 980 | + } |
|
| 921 | 981 | |
| 922 | 982 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
| 923 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
| 924 | - echo ' |
|
| 983 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
| 984 | + echo ' |
|
| 925 | 985 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
| 986 | + } |
|
| 926 | 987 | |
| 927 | 988 | // Can we restore topics? |
| 928 | - if ($context['can_restore_msg']) |
|
| 929 | - echo ' |
|
| 989 | + if ($context['can_restore_msg']) { |
|
| 990 | + echo ' |
|
| 930 | 991 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
| 992 | + } |
|
| 931 | 993 | |
| 932 | 994 | // Maybe we can approve it, maybe we should? |
| 933 | - if ($message['can_approve']) |
|
| 934 | - echo ' |
|
| 995 | + if ($message['can_approve']) { |
|
| 996 | + echo ' |
|
| 935 | 997 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
| 998 | + } |
|
| 936 | 999 | |
| 937 | 1000 | // Maybe we can unapprove it? |
| 938 | - if ($message['can_unapprove']) |
|
| 939 | - echo ' |
|
| 1001 | + if ($message['can_unapprove']) { |
|
| 1002 | + echo ' |
|
| 940 | 1003 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
| 1004 | + } |
|
| 941 | 1005 | |
| 942 | 1006 | echo ' |
| 943 | 1007 | </ul> |
| 944 | 1008 | </li>'; |
| 945 | 1009 | |
| 946 | 1010 | // Show a checkbox for quick moderation? |
| 947 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
| 948 | - echo ' |
|
| 1011 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
| 1012 | + echo ' |
|
| 949 | 1013 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
| 1014 | + } |
|
| 950 | 1015 | |
| 951 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 952 | - echo ' |
|
| 1016 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 1017 | + echo ' |
|
| 953 | 1018 | </ul><!-- .quickbuttons -->'; |
| 1019 | + } |
|
| 954 | 1020 | } |
| 955 | 1021 | |
| 956 | - if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 957 | - echo ' |
|
| 1022 | + if ($context['can_report_moderator'] || !empty($modSettings['enable_likes']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 1023 | + echo ' |
|
| 958 | 1024 | </div><!-- .under_message -->'; |
| 1025 | + } |
|
| 959 | 1026 | |
| 960 | 1027 | echo ' |
| 961 | 1028 | </div><!-- .postarea --> |
@@ -968,9 +1035,10 @@ discard block |
||
| 968 | 1035 | <div class="custom_fields_above_signature"> |
| 969 | 1036 | <ul class="nolist">'; |
| 970 | 1037 | |
| 971 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 972 | - echo ' |
|
| 1038 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 1039 | + echo ' |
|
| 973 | 1040 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1041 | + } |
|
| 974 | 1042 | |
| 975 | 1043 | echo ' |
| 976 | 1044 | </ul> |
@@ -978,11 +1046,12 @@ discard block |
||
| 978 | 1046 | } |
| 979 | 1047 | |
| 980 | 1048 | // Show the member's signature? |
| 981 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 982 | - echo ' |
|
| 1049 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 1050 | + echo ' |
|
| 983 | 1051 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '> |
| 984 | 1052 | ', $message['member']['signature'], ' |
| 985 | 1053 | </div>'; |
| 1054 | + } |
|
| 986 | 1055 | |
| 987 | 1056 | |
| 988 | 1057 | // Are there any custom profile fields for below the signature? |
@@ -992,9 +1061,10 @@ discard block |
||
| 992 | 1061 | <div class="custom_fields_below_signature"> |
| 993 | 1062 | <ul class="nolist">'; |
| 994 | 1063 | |
| 995 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 996 | - echo ' |
|
| 1064 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 1065 | + echo ' |
|
| 997 | 1066 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1067 | + } |
|
| 998 | 1068 | |
| 999 | 1069 | echo ' |
| 1000 | 1070 | </ul> |
@@ -1044,8 +1114,8 @@ discard block |
||
| 1044 | 1114 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
| 1045 | 1115 | |
| 1046 | 1116 | // Guests just need more. |
| 1047 | - if ($context['user']['is_guest']) |
|
| 1048 | - echo ' |
|
| 1117 | + if ($context['user']['is_guest']) { |
|
| 1118 | + echo ' |
|
| 1049 | 1119 | <dl id="post_header"> |
| 1050 | 1120 | <dt> |
| 1051 | 1121 | ', $txt['name'], ': |
@@ -1060,6 +1130,7 @@ discard block |
||
| 1060 | 1130 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" required> |
| 1061 | 1131 | </dd> |
| 1062 | 1132 | </dl>'; |
| 1133 | + } |
|
| 1063 | 1134 | |
| 1064 | 1135 | echo ' |
| 1065 | 1136 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1084,12 +1155,13 @@ discard block |
||
| 1084 | 1155 | </script>'; |
| 1085 | 1156 | |
| 1086 | 1157 | // Is visual verification enabled? |
| 1087 | - if ($context['require_verification']) |
|
| 1088 | - echo ' |
|
| 1158 | + if ($context['require_verification']) { |
|
| 1159 | + echo ' |
|
| 1089 | 1160 | <div class="post_verification"> |
| 1090 | 1161 | <strong>', $txt['verification'], ':</strong> |
| 1091 | 1162 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
| 1092 | 1163 | </div>'; |
| 1164 | + } |
|
| 1093 | 1165 | |
| 1094 | 1166 | // Finally, the submit buttons. |
| 1095 | 1167 | echo ' |
@@ -1105,8 +1177,8 @@ discard block |
||
| 1105 | 1177 | <br class="clear">'; |
| 1106 | 1178 | |
| 1107 | 1179 | // Draft autosave available and the user has it enabled? |
| 1108 | - if (!empty($context['drafts_autosave'])) |
|
| 1109 | - echo ' |
|
| 1180 | + if (!empty($context['drafts_autosave'])) { |
|
| 1181 | + echo ' |
|
| 1110 | 1182 | <script> |
| 1111 | 1183 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 1112 | 1184 | sSelf: \'oDraftAutoSave\', |
@@ -1118,12 +1190,14 @@ discard block |
||
| 1118 | 1190 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
| 1119 | 1191 | }); |
| 1120 | 1192 | </script>'; |
| 1193 | + } |
|
| 1121 | 1194 | |
| 1122 | - if ($context['show_spellchecking']) |
|
| 1123 | - echo ' |
|
| 1195 | + if ($context['show_spellchecking']) { |
|
| 1196 | + echo ' |
|
| 1124 | 1197 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"> |
| 1125 | 1198 | <input type="hidden" name="spellstring" value=""> |
| 1126 | 1199 | </form>'; |
| 1200 | + } |
|
| 1127 | 1201 | |
| 1128 | 1202 | echo ' |
| 1129 | 1203 | <script> |