Add test for public host in profile poll queue add

This commit is contained in:
Hypolite Petovan 2018-11-12 21:49:49 -05:00
parent 5207196e1a
commit 93e0153112

View file

@ -2,6 +2,8 @@
namespace Friendica\Directory\Models; namespace Friendica\Directory\Models;
use Friendica\Directory\Utils\Network;
/** /**
* @author Hypolite Petovan <mrpetovan@gmail.com> * @author Hypolite Petovan <mrpetovan@gmail.com>
*/ */
@ -15,6 +17,15 @@ class ProfilePollQueue extends \Friendica\Directory\Model
return false; return false;
} }
$host = parse_url($url, PHP_URL_HOST);
if (!$host) {
return false;
}
if (Network::isPublicHost($host)) {
return false;
}
$this->atlas->perform( $this->atlas->perform(
'INSERT IGNORE INTO `profile_poll_queue` SET `profile_url` = :profile_url', 'INSERT IGNORE INTO `profile_poll_queue` SET `profile_url` = :profile_url',
['profile_url' => $url] ['profile_url' => $url]