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

Loading…
Cancel
Save