|
|
@ -332,60 +332,54 @@ 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) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
|
|
|
if ($infoHash->version == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($infoHash->version == 1) |
|
|
|
$exist = true; |
|
|
|
{ |
|
|
|
|
|
|
|
$exist = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$exist) |
|
|
|
if (!$exist) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$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) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($infoHash = $db->getInfoHash($result->infoHashId)) |
|
|
|
if ($infoHash->version == 2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($infoHash->version == 2) |
|
|
|
$exist = true; |
|
|
|
{ |
|
|
|
|
|
|
|
$exist = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$exist) |
|
|
|
if (!$exist) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$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,50 +391,59 @@ 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) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$db->initMagnetToAddressTrackerId( |
|
|
|
if ($url = Yggverse\Parser\Url::parse($xs)) |
|
|
|
$local->magnetId, |
|
|
|
{ |
|
|
|
$db->initAddressTrackerId( |
|
|
|
$db->initMagnetToAddressTrackerId( |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$local->magnetId, |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
$db->initAddressTrackerId( |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
) |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
); |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// as |
|
|
|
// as |
|
|
|
foreach ($remote->as as $as) |
|
|
|
foreach ($remote->as as $as) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$db->initMagnetToAcceptableSourceId( |
|
|
|
if ($url = Yggverse\Parser\Url::parse($xs)) |
|
|
|
$local->magnetId, |
|
|
|
{ |
|
|
|
$db->initAcceptableSourceId( |
|
|
|
$db->initMagnetToAcceptableSourceId( |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$local->magnetId, |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
$db->initAcceptableSourceId( |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
) |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
); |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// xs |
|
|
|
// xs |
|
|
|
foreach ($remote->xs as $xs) |
|
|
|
foreach ($remote->xs as $xs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$db->initMagnetToExactSourceId( |
|
|
|
if ($url = Yggverse\Parser\Url::parse($xs)) |
|
|
|
$local->magnetId, |
|
|
|
{ |
|
|
|
$db->initExactSourceId( |
|
|
|
$db->initMagnetToExactSourceId( |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$local->magnetId, |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
$db->initExactSourceId( |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
$db->initSchemeId($url->host->scheme), |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
$db->initHostId($url->host->name), |
|
|
|
) |
|
|
|
$db->initPortId($url->host->port), |
|
|
|
); |
|
|
|
$db->initUriId($url->page->uri) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -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') |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|