| Conditions | 165 |
| Paths | > 20000 |
| Total Lines | 514 |
| Code Lines | 250 |
| Lines | 130 |
| Ratio | 25.29 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 454 | function template_single_post($message) |
||
| 455 | { |
||
| 456 | global $context, $settings, $options, $txt, $scripturl, $modSettings; |
||
| 457 | |||
| 458 | $ignoring = false; |
||
| 459 | |||
| 460 | if ($message['can_remove']) |
||
| 461 | $context['removableMessageIDs'][] = $message['id']; |
||
| 462 | |||
| 463 | // Are we ignoring this message? |
||
| 464 | if (!empty($message['is_ignored'])) |
||
| 465 | { |
||
| 466 | $ignoring = true; |
||
| 467 | $context['ignoredMsgs'][] = $message['id']; |
||
| 468 | } |
||
| 469 | |||
| 470 | // Show the message anchor and a "new" anchor if this message is new. |
||
| 471 | echo ' |
||
| 472 | <div class="', $message['css_class'] ,'">', $message['id'] != $context['first_message'] ? ' |
||
| 473 | <a id="msg' . $message['id'] . '"></a>' . ($message['first_new'] ? '<a id="new"></a>' : '') : '', ' |
||
| 474 | <div class="post_wrapper">'; |
||
| 475 | |||
| 476 | // Show information about the poster of this message. |
||
| 477 | echo ' |
||
| 478 | <div class="poster">'; |
||
| 479 | |||
| 480 | // Are there any custom fields above the member name? |
||
| 481 | View Code Duplication | if (!empty($message['custom_fields']['above_member'])) |
|
|
1 ignored issue
–
show
|
|||
| 482 | { |
||
| 483 | echo ' |
||
| 484 | <div class="custom_fields_above_member"> |
||
| 485 | <ul class="nolist">'; |
||
| 486 | |||
| 487 | foreach ($message['custom_fields']['above_member'] as $custom) |
||
| 488 | echo ' |
||
| 489 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 490 | |||
| 491 | echo ' |
||
| 492 | </ul> |
||
| 493 | </div>'; |
||
| 494 | } |
||
| 495 | |||
| 496 | echo ' |
||
| 497 | <h4>'; |
||
| 498 | |||
| 499 | // Show online and offline buttons? |
||
| 500 | if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
||
| 501 | echo ' |
||
| 502 | ', $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>' : ''; |
||
| 503 | |||
| 504 | |||
| 505 | // Show a link to the member's profile. |
||
| 506 | echo ' |
||
| 507 | ', $message['member']['link'], ' |
||
| 508 | </h4>'; |
||
| 509 | |||
| 510 | echo ' |
||
| 511 | <ul class="user_info">'; |
||
| 512 | |||
| 513 | |||
| 514 | // Show the user's avatar. |
||
| 515 | View Code Duplication | if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
|
1 ignored issue
–
show
|
|||
| 516 | echo ' |
||
| 517 | <li class="avatar"> |
||
| 518 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
||
| 519 | </li>'; |
||
| 520 | |||
| 521 | // Are there any custom fields below the avatar? |
||
| 522 | View Code Duplication | if (!empty($message['custom_fields']['below_avatar'])) |
|
|
1 ignored issue
–
show
|
|||
| 523 | foreach ($message['custom_fields']['below_avatar'] as $custom) |
||
| 524 | echo ' |
||
| 525 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 526 | |||
| 527 | // Show the post group icons, but not for guests. |
||
| 528 | if (!$message['member']['is_guest']) |
||
| 529 | echo ' |
||
| 530 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
||
| 531 | |||
| 532 | // Show the member's primary group (like 'Administrator') if they have one. |
||
| 533 | if (!empty($message['member']['group'])) |
||
| 534 | echo ' |
||
| 535 | <li class="membergroup">', $message['member']['group'], '</li>'; |
||
| 536 | |||
| 537 | // Show the member's custom title, if they have one. |
||
| 538 | if (!empty($message['member']['title'])) |
||
| 539 | echo ' |
||
| 540 | <li class="title">', $message['member']['title'], '</li>'; |
||
| 541 | |||
| 542 | // Don't show these things for guests. |
||
| 543 | if (!$message['member']['is_guest']) |
||
| 544 | { |
||
| 545 | |||
| 546 | // 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. |
||
| 547 | if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
||
| 548 | echo ' |
||
| 549 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
||
| 550 | |||
| 551 | // Show how many posts they have made. |
||
| 552 | View Code Duplication | if (!isset($context['disabled_fields']['posts'])) |
|
|
1 ignored issue
–
show
|
|||
| 553 | echo ' |
||
| 554 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
||
| 555 | |||
| 556 | // Show their personal text? |
||
| 557 | View Code Duplication | if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
|
1 ignored issue
–
show
|
|||
| 558 | echo ' |
||
| 559 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
||
| 560 | |||
| 561 | // Any custom fields to show as icons? |
||
| 562 | View Code Duplication | if (!empty($message['custom_fields']['icons'])) |
|
|
1 ignored issue
–
show
|
|||
| 563 | { |
||
| 564 | echo ' |
||
| 565 | <li class="im_icons"> |
||
| 566 | <ol>'; |
||
| 567 | |||
| 568 | foreach ($message['custom_fields']['icons'] as $custom) |
||
| 569 | echo ' |
||
| 570 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 571 | |||
| 572 | echo ' |
||
| 573 | </ol> |
||
| 574 | </li>'; |
||
| 575 | } |
||
| 576 | |||
| 577 | // Show the website and email address buttons. |
||
| 578 | if ($message['member']['show_profile_buttons']) |
||
| 579 | { |
||
| 580 | echo ' |
||
| 581 | <li class="profile"> |
||
| 582 | <ol class="profile_icons">'; |
||
| 583 | |||
| 584 | // Don't show an icon if they haven't specified a website. |
||
| 585 | View Code Duplication | if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
|
1 ignored issue
–
show
|
|||
| 586 | echo ' |
||
| 587 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
||
| 588 | |||
| 589 | // Since we know this person isn't a guest, you *can* message them. |
||
| 590 | View Code Duplication | if ($context['can_send_pm']) |
|
|
1 ignored issue
–
show
|
|||
| 591 | echo ' |
||
| 592 | <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>'; |
||
| 593 | |||
| 594 | // Show the email if necessary |
||
| 595 | View Code Duplication | if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
|
1 ignored issue
–
show
|
|||
| 596 | echo ' |
||
| 597 | <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>'; |
||
| 598 | |||
| 599 | echo ' |
||
| 600 | </ol> |
||
| 601 | </li>'; |
||
| 602 | } |
||
| 603 | |||
| 604 | // Any custom fields for standard placement? |
||
| 605 | View Code Duplication | if (!empty($message['custom_fields']['standard'])) |
|
|
1 ignored issue
–
show
|
|||
| 606 | foreach ($message['custom_fields']['standard'] as $custom) |
||
| 607 | echo ' |
||
| 608 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
||
| 609 | |||
| 610 | } |
||
| 611 | // Otherwise, show the guest's email. |
||
| 612 | View Code Duplication | elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
|
1 ignored issue
–
show
|
|||
| 613 | echo ' |
||
| 614 | <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>'; |
||
| 615 | |||
| 616 | // Show the IP to this user for this post - because you can moderate? |
||
| 617 | if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
||
| 618 | echo ' |
||
| 619 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
||
| 620 | |||
| 621 | // Or, should we show it because this is you? |
||
| 622 | elseif ($message['can_see_ip']) |
||
| 623 | echo ' |
||
| 624 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
||
| 625 | |||
| 626 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
||
| 627 | elseif (!$context['user']['is_guest']) |
||
| 628 | echo ' |
||
| 629 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
||
| 630 | |||
| 631 | // Otherwise, you see NOTHING! |
||
| 632 | else |
||
| 633 | echo ' |
||
| 634 | <li class="poster_ip">', $txt['logged'], '</li>'; |
||
| 635 | |||
| 636 | // Are we showing the warning status? |
||
| 637 | // Don't show these things for guests. |
||
| 638 | if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
||
| 639 | echo ' |
||
| 640 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
||
| 641 | |||
| 642 | // Are there any custom fields to show at the bottom of the poster info? |
||
| 643 | View Code Duplication | if (!empty($message['custom_fields']['bottom_poster'])) |
|
|
1 ignored issue
–
show
|
|||
| 644 | foreach ($message['custom_fields']['bottom_poster'] as $custom) |
||
| 645 | echo ' |
||
| 646 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 647 | |||
| 648 | // Poster info ends. |
||
| 649 | echo ' |
||
| 650 | </ul>'; |
||
| 651 | echo ' |
||
| 652 | </div> |
||
| 653 | <div class="postarea"> |
||
| 654 | <div class="keyinfo"> |
||
| 655 | <div class="messageicon" ', ($message['icon_url'] !== $settings['images_url'] . '/post/xx.png') ? '' : 'style="position: absolute; z-index: -1;"', '> |
||
| 656 | <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', '> |
||
| 657 | </div>'; |
||
| 658 | |||
| 659 | //Some people don't want subject ... The div is still required or quick edit breaks... |
||
| 660 | echo ' |
||
| 661 | <div id="subject_', $message['id'], '" class="subject_title">', (empty($modSettings['subject_toggle']) ? '' : '<a href="' . $message['href'] . '" rel="nofollow">' . $message['subject'] . '</a>'), '</div>'; |
||
| 662 | |||
| 663 | echo ' |
||
| 664 | <div class="page_number floatright"> |
||
| 665 | ', !empty($message['counter']) ? ' #' . $message['counter'] : '', ' ', ' |
||
| 666 | </div> |
||
| 667 | <h5> |
||
| 668 | <a href="', $message['href'], '" rel="nofollow" title="', !empty($message['counter']) ? sprintf($txt['reply_number'], $message['counter'], ' - ') : '', $message['subject'], '" class="smalltext">', $message['time'], '</a>'; |
||
| 669 | |||
| 670 | // Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified! |
||
| 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 | echo ' |
||
| 673 | <span class="smalltext modified" id="modified_', $message['id'], '">'; |
||
| 674 | |||
| 675 | if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
||
| 676 | echo |
||
| 677 | $message['modified']['last_edit_text']; |
||
| 678 | |||
| 679 | echo ' |
||
| 680 | </span>'; |
||
| 681 | |||
| 682 | echo ' |
||
| 683 | </h5> |
||
| 684 | <div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' style="display:none;"' : '', '></div> |
||
| 685 | </div>'; |
||
| 686 | |||
| 687 | // Ignoring this user? Hide the post. |
||
| 688 | View Code Duplication | if ($ignoring) |
|
|
1 ignored issue
–
show
|
|||
| 689 | echo ' |
||
| 690 | <div id="msg_', $message['id'], '_ignored_prompt"> |
||
| 691 | ', $txt['ignoring_user'], ' |
||
| 692 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
||
| 693 | </div>'; |
||
| 694 | |||
| 695 | // Show the post itself, finally! |
||
| 696 | echo ' |
||
| 697 | <div class="post">'; |
||
| 698 | |||
| 699 | if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
||
| 700 | echo ' |
||
| 701 | <div class="approve_post"> |
||
| 702 | ', $txt['post_awaiting_approval'], ' |
||
| 703 | </div>'; |
||
| 704 | echo ' |
||
| 705 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
||
| 706 | </div>'; |
||
| 707 | |||
| 708 | // Assuming there are attachments... |
||
| 709 | if (!empty($message['attachment'])) |
||
| 710 | { |
||
| 711 | $last_approved_state = 1; |
||
| 712 | $attachments_per_line = 5; |
||
| 713 | $i = 0; |
||
| 714 | // Don't output the div unless we actually have something to show... |
||
| 715 | $div_output = false; |
||
| 716 | |||
| 717 | foreach ($message['attachment'] as $attachment) |
||
| 718 | { |
||
| 719 | // Do we want this attachment to not be showed here? |
||
| 720 | if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
||
| 721 | continue; |
||
| 722 | elseif (!$div_output) |
||
| 723 | { |
||
| 724 | $div_output = true; |
||
| 725 | |||
| 726 | echo ' |
||
| 727 | <div id="msg_', $message['id'], '_footer" class="attachments"', $ignoring ? ' style="display:none;"' : '', '>'; |
||
| 728 | } |
||
| 729 | |||
| 730 | // Show a special box for unapproved attachments... |
||
| 731 | if ($attachment['is_approved'] != $last_approved_state) |
||
| 732 | { |
||
| 733 | $last_approved_state = 0; |
||
| 734 | echo ' |
||
| 735 | <fieldset> |
||
| 736 | <legend>', $txt['attach_awaiting_approve']; |
||
| 737 | |||
| 738 | if ($context['can_approve']) |
||
| 739 | echo ' |
||
| 740 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
||
| 741 | |||
| 742 | echo ' |
||
| 743 | </legend>'; |
||
| 744 | } |
||
| 745 | |||
| 746 | echo ' |
||
| 747 | <div class="floatleft attached">'; |
||
| 748 | |||
| 749 | if ($attachment['is_image']) |
||
| 750 | { |
||
| 751 | echo ' |
||
| 752 | <div class="attachments_top">'; |
||
| 753 | |||
| 754 | if ($attachment['thumbnail']['has_thumb']) |
||
| 755 | echo ' |
||
| 756 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
||
| 757 | else |
||
| 758 | echo ' |
||
| 759 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
||
| 760 | |||
| 761 | echo ' |
||
| 762 | </div>'; |
||
| 763 | } |
||
| 764 | |||
| 765 | echo ' |
||
| 766 | <div class="attachments_bot"> |
||
| 767 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
||
| 768 | |||
| 769 | if (!$attachment['is_approved'] && $context['can_approve']) |
||
| 770 | echo ' |
||
| 771 | [<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>] '; |
||
| 772 | echo ' |
||
| 773 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
||
| 774 | </div>'; |
||
| 775 | |||
| 776 | echo ' |
||
| 777 | </div>'; |
||
| 778 | |||
| 779 | // Next attachment line ? |
||
| 780 | if (++$i % $attachments_per_line === 0) |
||
| 781 | echo ' |
||
| 782 | <br>'; |
||
| 783 | } |
||
| 784 | |||
| 785 | // If we had unapproved attachments clean up. |
||
| 786 | if ($last_approved_state == 0) |
||
| 787 | echo ' |
||
| 788 | </fieldset>'; |
||
| 789 | |||
| 790 | // Only do this if we output a div above - otherwise it'll break things |
||
| 791 | if ($div_output) |
||
| 792 | echo ' |
||
| 793 | </div>'; |
||
| 794 | } |
||
| 795 | |||
| 796 | // And stuff below the attachments. |
||
| 797 | View Code Duplication | if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $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']) |
|
|
1 ignored issue
–
show
|
|||
| 798 | echo ' |
||
| 799 | <div class="under_message">'; |
||
| 800 | |||
| 801 | // Maybe they want to report this post to the moderator(s)? |
||
| 802 | if ($context['can_report_moderator']) |
||
| 803 | echo ' |
||
| 804 | <ul class="floatright smalltext"> |
||
| 805 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
||
| 806 | </ul>'; |
||
| 807 | |||
| 808 | // What about likes? |
||
| 809 | if (!empty($modSettings['enable_likes'])) |
||
| 810 | { |
||
| 811 | echo ' |
||
| 812 | <ul class="floatleft">'; |
||
| 813 | |||
| 814 | if (!empty($message['likes']['can_like'])) |
||
| 815 | { |
||
| 816 | echo ' |
||
| 817 | <li class="like_button" id="msg_', $message['id'], '_likes"', $ignoring ? ' style="display:none;"' : '', '><a href="', $scripturl, '?action=likes;ltype=msg;sa=like;like=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="msg_like"><span class="generic_icons ', $message['likes']['you'] ? 'unlike' : 'like', '"></span> ', $message['likes']['you'] ? $txt['unlike'] : $txt['like'], '</a></li>'; |
||
| 818 | } |
||
| 819 | |||
| 820 | View Code Duplication | if (!empty($message['likes']['count']) && !empty($context['can_see_likes'])) |
|
|
1 ignored issue
–
show
|
|||
| 821 | { |
||
| 822 | $context['some_likes'] = true; |
||
| 823 | $count = $message['likes']['count']; |
||
| 824 | $base = 'likes_'; |
||
| 825 | if ($message['likes']['you']) |
||
| 826 | { |
||
| 827 | $base = 'you_' . $base; |
||
| 828 | $count--; |
||
| 829 | } |
||
| 830 | $base .= (isset($txt[$base . $count])) ? $count : 'n'; |
||
| 831 | |||
| 832 | echo ' |
||
| 833 | <li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $message['id'] .';'. $context['session_var'] .'='. $context['session_id'], comma_format($count)), '</li>'; |
||
| 834 | } |
||
| 835 | |||
| 836 | echo ' |
||
| 837 | </ul>'; |
||
| 838 | } |
||
| 839 | |||
| 840 | // Show the quickbuttons, for various operations on posts. |
||
| 841 | if ($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']) |
||
| 842 | { |
||
| 843 | echo ' |
||
| 844 | <ul class="quickbuttons">'; |
||
| 845 | |||
| 846 | // Can they quote? if so they can select and quote as well! |
||
| 847 | if ($context['can_quote']) |
||
| 848 | echo ' |
||
| 849 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
||
| 850 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>'; |
||
| 851 | |||
| 852 | // Can the user modify the contents of this post? Show the modify inline image. |
||
| 853 | if ($message['can_modify']) |
||
| 854 | echo ' |
||
| 855 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
||
| 856 | |||
| 857 | View Code Duplication | if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
|
1 ignored issue
–
show
|
|||
| 858 | echo ' |
||
| 859 | <li class="post_options">', $txt['post_options']; |
||
| 860 | |||
| 861 | echo ' |
||
| 862 | <ul>'; |
||
| 863 | |||
| 864 | // Can the user modify the contents of this post? |
||
| 865 | if ($message['can_modify']) |
||
| 866 | echo ' |
||
| 867 | <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>'; |
||
| 868 | |||
| 869 | // How about... even... remove it entirely?! |
||
| 870 | if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
||
| 871 | echo ' |
||
| 872 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>'; |
||
| 873 | View Code Duplication | elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
|
1 ignored issue
–
show
|
|||
| 874 | echo ' |
||
| 875 | <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>'; |
||
| 876 | |||
| 877 | // What about splitting it off the rest of the topic? |
||
| 878 | if ($context['can_split'] && !empty($context['real_num_replies'])) |
||
| 879 | echo ' |
||
| 880 | <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>'; |
||
| 881 | |||
| 882 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
||
| 883 | if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
||
| 884 | echo ' |
||
| 885 | <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>'; |
||
| 886 | |||
| 887 | // Can we restore topics? |
||
| 888 | if ($context['can_restore_msg']) |
||
| 889 | echo ' |
||
| 890 | <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>'; |
||
| 891 | |||
| 892 | // Maybe we can approve it, maybe we should? |
||
| 893 | if ($message['can_approve']) |
||
| 894 | echo ' |
||
| 895 | <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>'; |
||
| 896 | |||
| 897 | // Maybe we can unapprove it? |
||
| 898 | if ($message['can_unapprove']) |
||
| 899 | echo ' |
||
| 900 | <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>'; |
||
| 901 | |||
| 902 | echo ' |
||
| 903 | </ul> |
||
| 904 | </li>'; |
||
| 905 | |||
| 906 | // Show a checkbox for quick moderation? |
||
| 907 | View Code Duplication | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
|
1 ignored issue
–
show
|
|||
| 908 | echo ' |
||
| 909 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
||
| 910 | |||
| 911 | View Code Duplication | if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
|
1 ignored issue
–
show
|
|||
| 912 | echo ' |
||
| 913 | </ul>'; |
||
| 914 | } |
||
| 915 | |||
| 916 | View Code Duplication | if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $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']) |
|
|
1 ignored issue
–
show
|
|||
| 917 | echo ' |
||
| 918 | </div>'; |
||
| 919 | |||
| 920 | echo ' |
||
| 921 | </div> |
||
| 922 | <div class="moderatorbar">'; |
||
| 923 | |||
| 924 | // Are there any custom profile fields for above the signature? |
||
| 925 | View Code Duplication | if (!empty($message['custom_fields']['above_signature'])) |
|
|
1 ignored issue
–
show
|
|||
| 926 | { |
||
| 927 | echo ' |
||
| 928 | <div class="custom_fields_above_signature"> |
||
| 929 | <ul class="nolist">'; |
||
| 930 | |||
| 931 | foreach ($message['custom_fields']['above_signature'] as $custom) |
||
| 932 | echo ' |
||
| 933 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 934 | |||
| 935 | echo ' |
||
| 936 | </ul> |
||
| 937 | </div>'; |
||
| 938 | } |
||
| 939 | |||
| 940 | // Show the member's signature? |
||
| 941 | if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
||
| 942 | echo ' |
||
| 943 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
||
| 944 | |||
| 945 | |||
| 946 | // Are there any custom profile fields for below the signature? |
||
| 947 | View Code Duplication | if (!empty($message['custom_fields']['below_signature'])) |
|
|
1 ignored issue
–
show
|
|||
| 948 | { |
||
| 949 | echo ' |
||
| 950 | <div class="custom_fields_below_signature"> |
||
| 951 | <ul class="nolist">'; |
||
| 952 | |||
| 953 | foreach ($message['custom_fields']['below_signature'] as $custom) |
||
| 954 | echo ' |
||
| 955 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
||
| 956 | |||
| 957 | echo ' |
||
| 958 | </ul> |
||
| 959 | </div>'; |
||
| 960 | } |
||
| 961 | |||
| 962 | echo ' |
||
| 963 | </div> |
||
| 964 | </div> |
||
| 965 | </div> |
||
| 966 | <hr class="post_separator">'; |
||
| 967 | } |
||
| 968 | |||
| 1105 |
This check looks for functions that have already been defined in other files.
Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the
@ignoreannotation.See also the PhpDoc documentation for @ignore.