From: Alexander Ebert Date: Fri, 11 May 2018 10:21:01 +0000 (+0200) Subject: Avoid notifications for quotes with an external source X-Git-Tag: 3.1.3~32 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f13c0d41890e892ca458331d410db5eb860d3f3;p=GitHub%2FWoltLab%2FWCF.git Avoid notifications for quotes with an external source --- diff --git a/wcfsetup/install/files/lib/util/MessageUtil.class.php b/wcfsetup/install/files/lib/util/MessageUtil.class.php index 5a51e3d0d2..589c066993 100644 --- a/wcfsetup/install/files/lib/util/MessageUtil.class.php +++ b/wcfsetup/install/files/lib/util/MessageUtil.class.php @@ -1,5 +1,6 @@ getApplications() as $application) { + if (!in_array($application->domainName, $ownHosts)) $ownHosts[] = $application->domainName; + } + } + $usernames = []; $elements = $htmlInputProcessor->getHtmlInputNodeProcessor()->getDocument()->getElementsByTagName('woltlab-quote'); /** @var \DOMElement $element */ foreach ($elements as $element) { $username = $element->getAttribute('data-author'); - if (!empty($username)) $usernames[] = $username; + if (!empty($username)) { + // check if there is a link set and if it points to any of the apps + $link = $element->getAttribute('data-link'); + $host = ($link) ? Url::parse($link)['host'] : ''; + if ($host && !in_array($host, $ownHosts)) { + // links mismatch, do not treat this occurrence as a username + continue; + } + + $usernames[] = $username; + } } return $usernames;