Browse Source

add missed protocol conditions

main
ghost 1 year ago
parent
commit
89d0ffdfe1
  1. 10
      src/crontab/import/feed.php

10
src/crontab/import/feed.php

@ -87,9 +87,10 @@ try
foreach (@json_decode(@file_get_contents($manifest->export->users)) as $remoteUser) foreach (@json_decode(@file_get_contents($manifest->export->users)) as $remoteUser)
{ {
// Validate required fields // Validate required fields
if (!isset($remoteUser->address) || !preg_match(YGGDRASIL_HOST_REGEX, $remoteUser->address) || if (!isset($remoteUser->userId) || !is_int($remoteUser->userId) ||
!isset($remoteUser->timeAdded) || !is_int($remoteUser->timeAdded) || !isset($remoteUser->address) || !is_string($remoteUser->address) ||
!isset($remoteUser->timeUpdated) || !is_int($remoteUser->timeUpdated) || !isset($remoteUser->timeAdded) || !is_int($remoteUser->timeAdded) ||
!isset($remoteUser->timeUpdated) || !is_int($remoteUser->timeUpdated) ||
!isset($remoteUser->approved) || !is_bool($remoteUser->approved)) !isset($remoteUser->approved) || !is_bool($remoteUser->approved))
{ {
continue; continue;
@ -173,7 +174,8 @@ try
foreach (@json_decode(@file_get_contents($manifest->export->magnets)) as $remoteMagnet) foreach (@json_decode(@file_get_contents($manifest->export->magnets)) as $remoteMagnet)
{ {
// Validate required fields by protocol // Validate required fields by protocol
if (!isset($remoteMagnet->userId) || !is_int($remoteMagnet->userId) || if (!isset($remoteMagnet->magnetId) || !is_int($remoteMagnet->magnetId) ||
!isset($remoteMagnet->userId) || !is_int($remoteMagnet->userId) ||
!isset($aliasUserId[$remoteMagnet->userId]) || !isset($aliasUserId[$remoteMagnet->userId]) ||
!$db->getUser($aliasUserId[$remoteMagnet->userId]) || !$db->getUser($aliasUserId[$remoteMagnet->userId]) ||

Loading…
Cancel
Save