Browse Source

remove filters and parsing for validated data

main
ghost 1 year ago
parent
commit
6cfba39d1d
  1. 26
      src/public/api/push.php

26
src/public/api/push.php

@ -332,8 +332,6 @@ else
{ {
case 1: case 1:
if (Yggverse\Parser\Magnet::isXTv1($xt->value))
{
$exist = false; $exist = false;
foreach ($db->findMagnetToInfoHashByMagnetId($local->magnetId) as $result) foreach ($db->findMagnetToInfoHashByMagnetId($local->magnetId) as $result)
@ -352,18 +350,15 @@ else
$db->addMagnetToInfoHash( $db->addMagnetToInfoHash(
$local->magnetId, $local->magnetId,
$db->initInfoHashId( $db->initInfoHashId(
Yggverse\Parser\Magnet::filterInfoHash($xt->value), 1 $xt->value, 1
) )
); );
} }
}
break; break;
case 2: case 2:
if (Yggverse\Parser\Magnet::isXTv2($xt->value))
{
$exist = false; $exist = false;
foreach ($db->findMagnetToInfoHashByMagnetId($local->magnetId) as $result) foreach ($db->findMagnetToInfoHashByMagnetId($local->magnetId) as $result)
@ -382,11 +377,10 @@ else
$db->addMagnetToInfoHash( $db->addMagnetToInfoHash(
$local->magnetId, $local->magnetId,
$db->initInfoHashId( $db->initInfoHashId(
Yggverse\Parser\Magnet::filterInfoHash($xt->value), 2 $xt->value, 2
) )
); );
} }
}
break; break;
} }
@ -397,12 +391,14 @@ else
{ {
$db->initMagnetToKeywordTopicId( $db->initMagnetToKeywordTopicId(
$local->magnetId, $local->magnetId,
$db->initKeywordTopicId(trim(mb_strtolower(strip_tags(html_entity_decode($kt))))) $db->initKeywordTopicId(trim(mb_strtolower($kt)))
); );
} }
// tr // tr
foreach ($remote->tr as $tr) foreach ($remote->tr as $tr)
{
if ($url = Yggverse\Parser\Url::parse($xs))
{ {
$db->initMagnetToAddressTrackerId( $db->initMagnetToAddressTrackerId(
$local->magnetId, $local->magnetId,
@ -414,9 +410,12 @@ else
) )
); );
} }
}
// as // as
foreach ($remote->as as $as) foreach ($remote->as as $as)
{
if ($url = Yggverse\Parser\Url::parse($xs))
{ {
$db->initMagnetToAcceptableSourceId( $db->initMagnetToAcceptableSourceId(
$local->magnetId, $local->magnetId,
@ -428,9 +427,12 @@ else
) )
); );
} }
}
// xs // xs
foreach ($remote->xs as $xs) foreach ($remote->xs as $xs)
{
if ($url = Yggverse\Parser\Url::parse($xs))
{ {
$db->initMagnetToExactSourceId( $db->initMagnetToExactSourceId(
$local->magnetId, $local->magnetId,
@ -443,6 +445,7 @@ else
); );
} }
} }
}
$response = [ $response = [
'status' => true, 'status' => true,
@ -550,7 +553,7 @@ else
{ {
$response = [ $response = [
'status' => false, 'status' => false,
'message' => $error 'message' => $error,
]; ];
continue 2; continue 2;
@ -695,10 +698,11 @@ else
break; break;
default: default:
$response = $response =
[ [
'status' => false, 'status' => false,
'message' => _('Data type not supported') 'message' => _('Data field not supported')
]; ];
} }

Loading…
Cancel
Save