Commit 34232ecc authored by Patrick Schmalstig's avatar Patrick Schmalstig
Browse files

Implemented MANTIS-5516 (Improvements to the automatic prepped e-mails to site...

Implemented MANTIS-5516 (Improvements to the automatic prepped e-mails to site owners in warnings forms)
parent 529f7eb5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ MARK_AS_SPAMMER=Mark as spammer
PREPARE_EMAIL=Prepare e-mail to site owner
PREPARE_EMAIL_DESCRIPTION=This will prepare an e-mail to the site owner, showing what spam has been posted on their behalf. You will need to find their actual e-mail address from their website.
PREPARE_EMAIL_SUBJECT=A spammer is working for you
PREPARE_EMAIL_BODY=To whom it may concern,\n\nYou appear to have employed the services of an SEO company, who is spamming web forums such as ours with links to your organisation's website. Evidence of this is included at the bottom of this e-mail.\n\nSearch Engines (e.g. Google) will negatively rank you if they detect that incoming links to your site are actually spam links. Your choice of this SEO provider is likely hurting you much more than helping you.\n\nI recommend that you:\n(1) Cease any business relationship with this company\n(2) Clean up any links pointing to your site to protect your SEO reputation (search engines have "disavow" functionality you can look into)\n(3) Consider reporting them to appropriate authorities for fraud\n\nPlease also reply to me with details of the company you think has done this, so that we can confirm this spamming was not directly authorised by you.\n\nYours sincerely,\nThe {3} team\n\n\n(below is what was posted on our forum by the spammer)\n\n{2}\n
PREPARE_EMAIL_BODY=To whom it may concern,\n\nYou appear to have employed the services of a SEO company or individual, who is spamming websites such as ours with links to your organisation's website. Evidence of this is included at the bottom of this e-mail.\n\nSearch Engines (e.g. Google) will negatively rank you if they detect that incoming links to your site are derived from spam links. Your choice of this SEO provider is likely hurting you much more than helping you.\n\nI recommend that you:\n(1) Cease any business relationship with this company or individual\n(2) Clean up any links pointing to your site to protect your SEO reputation (search engines have "disavow" functionality you can look into)\n(3) Consider reporting them to appropriate authorities for fraud\n\nPlease also reply to me with details of the company or individual you think has done this, so that we can confirm this spamming was not directly authorised by you.\n\nYours sincerely,\nThe {3} team\n\n\n(below is what was posted on our website by the spammer)\n\n{2}\n

HANDLE_POST__POST_STANDALONE_AT_END=Post at end of <a target="_blank" title="{1} (this link will open in a new window)" href="{4}">{1}</a>
HANDLE_POST__POST_STANDALONE_IN_MIDDLE=Post in middle of <a target="_blank" title="{1} (this link will open in a new window)" href="{4}">{1}</a>
+2 −2
Original line number Diff line number Diff line
@@ -500,10 +500,10 @@ function semihtml_to_comcode(string $semihtml, bool $force = false, bool $quick

    // Optimisations
    $matches = [];
    if (preg_match('#^\[semihtml\]([^\[\]<>]*)\[\/semihtml\]$#', $semihtml, $matches) != 0) {
    if (preg_match('#^\[semihtml\]([^\[\]<>]*)\[\/semihtml\]$#', $semihtml, $matches) != 0) { // Already have semihtml tags
        return $matches[1];
    }
    if (preg_match('#^([^\[\]<>\{\}&]*)$#', $semihtml) != 0) {
    if (preg_match('#^([^\[\]<>\{\}&]*)$#', $semihtml) != 0) { // Plain-text
        return $semihtml;
    }

+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ function _strip_comcode(string $in, bool $for_extract = false, array $tags_to_pr
        'attachment',
        'attachment_safe',
    ], $tags_to_preserve);
    if ($include_urls) {
    if (!$include_urls) {
        $tags_to_strip_entirely[] = 'media';
        $tags_to_strip_entirely[] = 'url';
        $tags_to_strip_entirely[] = 'email';
+5 −3
Original line number Diff line number Diff line
@@ -97,13 +97,15 @@ class Hook_cns_warnings_content
        define('POST_AS_TOPIC_FULL', 2);
        define('POST_AS_TOPIC_STARTER', 3);

        require_code('comcode');
        require_code('comcode_from_html');

        $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id);

        // Get form fields for actions on forum topics / posts
        $posts_deletable = [];
        if (has_delete_permission('mid', get_member(), $member_id, 'topics')) {
            $time_limit = time() - (60 * 60 * 24 * 7); // Limit to posts within the last 7 days
            $max = 50; // Limit to the last 50 posts
            if (
                (($GLOBALS['DEV_MODE']) || ($spam_mode)) && // i.e. we are dealing with this user as a spammer
                ((!is_guest($member_id)) || ($ip_address !== null))
@@ -114,7 +116,7 @@ class Hook_cns_warnings_content
                } else {
                    $where['p_poster'] = $member_id;
                }
                $sup = ' AND p_time<' . strval($time_limit) . ' ORDER BY p_time DESC';
                $sup = ' AND p_time>' . strval($time_limit) . ' ORDER BY p_time DESC';
                if (!has_privilege(get_member(), 'view_other_pt')) {
                    $sup = ' AND p_cache_forum_id IS NOT NULL ' . $sup;
                }
@@ -139,7 +141,7 @@ class Hook_cns_warnings_content
                                    $spam_urls[$domain]['URLS'][$spam_url] = ['I' => strval(count($spam_urls[$domain]['URLS'])), 'URL' => $spam_url];
                                }
                                if (!isset($spam_urls[$domain]['POSTS'][$post['id']])) {
                                    $spam_urls[$domain]['POSTS'][$post['id']] = ['I' => strval(count($spam_urls[$domain]['POSTS'])), 'POST_TITLE' => $post['p_title'], 'POST' => strip_html($post_text->evaluate())];
                                    $spam_urls[$domain]['POSTS'][$post['id']] = ['I' => strval(count($spam_urls[$domain]['POSTS'])), 'POST_TITLE' => $post['p_title'], 'POST' => strip_comcode(semihtml_to_comcode($post_text->evaluate(), true), false, [], false)];
                                }
                            }
                        }