X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FGProbe.php;h=116ca207025d90cad7677b96cf8bb957d60bf2fa;hb=c0a24d80dda2dccf44579b1ae0ddba87abead658;hp=5222fb61ccfdba1d7ac8eae3fe2c8fa000341f91;hpb=26b335ef3d8b1ec4e1b4e22cd7d3c34e66d2549d;p=friendica.git diff --git a/src/Worker/GProbe.php b/src/Worker/GProbe.php index 5222fb61cc..116ca20702 100644 --- a/src/Worker/GProbe.php +++ b/src/Worker/GProbe.php @@ -6,14 +6,12 @@ namespace Friendica\Worker; use Friendica\Core\Cache; -use Friendica\Core\Config; -use Friendica\Database\DBM; +use Friendica\Core\Protocol; +use Friendica\Database\DBA; use Friendica\Model\GContact; use Friendica\Network\Probe; use Friendica\Protocol\PortableContact; -require_once 'include/datetime.php'; - class GProbe { public static function execute($url = '') { @@ -23,18 +21,18 @@ class GProbe { $r = q( "SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1", - dbesc(normalise_link($url)) + DBA::escape(normalise_link($url)) ); logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG); - if (!DBM::is_result($r)) { + if (!DBA::isResult($r)) { // Is it a DDoS attempt? $urlparts = parse_url($url); $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { - if (in_array($result["network"], [NETWORK_FEED, NETWORK_PHANTOM])) { + if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) { logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG); return; } @@ -46,18 +44,18 @@ class GProbe { Cache::set("gprobe:".$urlparts["host"], $arr); } - if (!in_array($arr["network"], [NETWORK_FEED, NETWORK_PHANTOM])) { + if (!in_array($arr["network"], [Protocol::FEED, Protocol::PHANTOM])) { GContact::update($arr); } $r = q( "SELECT `id`, `url`, `network` FROM `gcontact` WHERE `nurl` = '%s' ORDER BY `id` LIMIT 1", - dbesc(normalise_link($url)) + DBA::escape(normalise_link($url)) ); } - if (DBM::is_result($r)) { + if (DBA::isResult($r)) { // Check for accessibility and do a poco discovery - if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) { + if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == Protocol::DFRN)) { PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url'])); } }