mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-09-13 06:42:31 +00:00
use common Valid library methods to check URL and addresses
This commit is contained in:
parent
eb43fb4b18
commit
43c617e893
@ -269,7 +269,7 @@ try
|
|||||||
$uri = $db->getUri($addressTracker->uriId);
|
$uri = $db->getUri($addressTracker->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ try
|
|||||||
$uri = $db->getUri($acceptableSource->uriId);
|
$uri = $db->getUri($acceptableSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ try
|
|||||||
$uri = $db->getUri($eXactSource->uriId);
|
$uri = $db->getUri($eXactSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ if (API_EXPORT_PUSH_ENABLED)
|
|||||||
$uri = $db->getUri($addressTracker->uriId);
|
$uri = $db->getUri($addressTracker->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ if (API_EXPORT_PUSH_ENABLED)
|
|||||||
$uri = $db->getUri($acceptableSource->uriId);
|
$uri = $db->getUri($acceptableSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ if (API_EXPORT_PUSH_ENABLED)
|
|||||||
$uri = $db->getUri($eXactSource->uriId);
|
$uri = $db->getUri($eXactSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -310,12 +310,9 @@ if (API_EXPORT_PUSH_ENABLED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip sending to non-condition addresses
|
// Skip sending to non-condition addresses
|
||||||
if ($pushUrl = Yggverse\Parser\Url::parse($manifest->import->push))
|
if (!Valid::url($manifest->import->push))
|
||||||
{
|
{
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $pushUrl->host->name)))
|
continue;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -35,31 +35,19 @@ try
|
|||||||
file_get_contents(__DIR__ . '/../../config/nodes.json')
|
file_get_contents(__DIR__ . '/../../config/nodes.json')
|
||||||
) as $node)
|
) as $node)
|
||||||
{
|
{
|
||||||
|
// Skip non-condition addresses
|
||||||
// Skip reading to non-condition addresses
|
if (!Valid::url($node->manifest))
|
||||||
if ($manifestUrl = Yggverse\Parser\Url::parse($node->manifest))
|
|
||||||
{
|
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $manifestUrl->host->name)))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip reading current host
|
// Skip current host
|
||||||
if ($thisUrl = Yggverse\Parser\Url::parse(WEBSITE_URL))
|
$thisUrl = Yggverse\Parser\Url::parse(WEBSITE_URL);
|
||||||
{
|
$manifestUrl = Yggverse\Parser\Url::parse($node->manifest);
|
||||||
if ($manifestUrl->host->name == $thisUrl->host->name) // @TODO some mirrors could be available, improve condition
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
if (empty($manifestUrl->host->name) ||
|
||||||
|
empty($manifestUrl->host->name) ||
|
||||||
|
$manifestUrl->host->name == $thisUrl->host->name) // @TODO some mirrors could be available, improve condition
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,102 @@ class Valid
|
|||||||
private static $_error = [];
|
private static $_error = [];
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
public static function getError()
|
public static function getError() : array
|
||||||
{
|
{
|
||||||
return self::$_error;
|
return self::$_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setError(array $value)
|
public static function setError(array $value) : void
|
||||||
{
|
{
|
||||||
self::$_error = $value;
|
self::$_error = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function host(mixed $value) : bool
|
||||||
|
{
|
||||||
|
if (!is_string($value))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
_('Invalid host data type')
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
sprintf(
|
||||||
|
_('Host "%s" not match condition "%s"'),
|
||||||
|
$value,
|
||||||
|
YGGDRASIL_HOST_REGEX
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function url(mixed $value) : bool
|
||||||
|
{
|
||||||
|
if (!is_string($value))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
_('Invalid URL data type')
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$url = Yggverse\Parser\Url::parse($value))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
sprintf(
|
||||||
|
_('URL "%s" invalid'),
|
||||||
|
$value
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($url->host->name))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
sprintf(
|
||||||
|
_('Could not init host name for URL "%s"'),
|
||||||
|
$value
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self::host($url->host->name))
|
||||||
|
{
|
||||||
|
array_push(
|
||||||
|
self::$_error,
|
||||||
|
sprintf(
|
||||||
|
_('URL host "%s" not supported'),
|
||||||
|
$value,
|
||||||
|
$url->host->name
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// User
|
// User
|
||||||
public static function user(mixed $value)
|
public static function user(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -48,7 +132,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userId(mixed $value)
|
public static function userId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -63,7 +147,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userAddress(mixed $value)
|
public static function userAddress(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -75,13 +159,13 @@ class Valid
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $value))
|
if (!self::host($value))
|
||||||
{
|
{
|
||||||
array_push(
|
array_push(
|
||||||
self::$_error,
|
self::$_error,
|
||||||
sprintf(
|
sprintf(
|
||||||
_('User address format does not match condition "%s"'),
|
_('User address "%s" not supported'),
|
||||||
YGGDRASIL_HOST_REGEX
|
$value
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -91,7 +175,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userTimeAdded(mixed $value)
|
public static function userTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -116,7 +200,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userTimeUpdated(mixed $value)
|
public static function userTimeUpdated(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!(is_int($value) || is_bool($value)))
|
if (!(is_int($value) || is_bool($value)))
|
||||||
{
|
{
|
||||||
@ -141,7 +225,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userApproved(mixed $value)
|
public static function userApproved(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -156,7 +240,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userPublic(mixed $value)
|
public static function userPublic(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -172,7 +256,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Magnet
|
// Magnet
|
||||||
public static function magnet(mixed $data)
|
public static function magnet(mixed $data) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($data))
|
if (!is_object($data))
|
||||||
{
|
{
|
||||||
@ -224,7 +308,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetId(mixed $value)
|
public static function magnetId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -239,7 +323,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetTitle(mixed $value)
|
public static function magnetTitle(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -282,7 +366,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetPreview(mixed $value)
|
public static function magnetPreview(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -325,7 +409,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetDescription(mixed $value)
|
public static function magnetDescription(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -368,7 +452,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetComments(mixed $value)
|
public static function magnetComments(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -383,7 +467,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetPublic(mixed $value)
|
public static function magnetPublic(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -398,7 +482,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetApproved(mixed $value)
|
public static function magnetApproved(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -413,7 +497,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetSensitive(mixed $value)
|
public static function magnetSensitive(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -428,7 +512,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetTimeAdded(mixed $value)
|
public static function magnetTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -453,7 +537,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetTimeUpdated(mixed $value)
|
public static function magnetTimeUpdated(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!(is_int($value) || is_bool($value)))
|
if (!(is_int($value) || is_bool($value)))
|
||||||
{
|
{
|
||||||
@ -478,7 +562,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetDn(mixed $value)
|
public static function magnetDn(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -521,7 +605,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetXl(mixed $value)
|
public static function magnetXl(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!(is_int($value) || is_float($value)))
|
if (!(is_int($value) || is_float($value)))
|
||||||
{
|
{
|
||||||
@ -536,7 +620,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetKt(mixed $value)
|
public static function magnetKt(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -611,7 +695,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetXt(mixed $value)
|
public static function magnetXt(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -689,7 +773,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetTr(mixed $value)
|
public static function magnetTr(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -705,33 +789,13 @@ class Valid
|
|||||||
|
|
||||||
foreach ($value as $tr)
|
foreach ($value as $tr)
|
||||||
{
|
{
|
||||||
if (!$url = Yggverse\Parser\Url::parse($tr))
|
if (!self::url($tr))
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet address tracker URL')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($url->host->name))
|
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet address tracker host name')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
|
||||||
{
|
{
|
||||||
array_push(
|
array_push(
|
||||||
self::$_error,
|
self::$_error,
|
||||||
sprintf(
|
sprintf(
|
||||||
_('Magnet address tracker format does not match condition "%s"'),
|
_('Invalid magnet address tracker URL "%s"'),
|
||||||
YGGDRASIL_HOST_REGEX
|
$tr
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -759,7 +823,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetAs(mixed $value)
|
public static function magnetAs(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -775,33 +839,13 @@ class Valid
|
|||||||
|
|
||||||
foreach ($value as $as)
|
foreach ($value as $as)
|
||||||
{
|
{
|
||||||
if (!$url = Yggverse\Parser\Url::parse($as))
|
if (!self::url($as))
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet acceptable source URL')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($url->host->name))
|
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet acceptable source host name')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
|
||||||
{
|
{
|
||||||
array_push(
|
array_push(
|
||||||
self::$_error,
|
self::$_error,
|
||||||
sprintf(
|
sprintf(
|
||||||
_('Magnet acceptable source format does not match condition "%s"'),
|
_('Invalid magnet acceptable source URL "%s"'),
|
||||||
YGGDRASIL_HOST_REGEX
|
$as
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -829,7 +873,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetWs(mixed $value)
|
public static function magnetWs(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -845,33 +889,13 @@ class Valid
|
|||||||
|
|
||||||
foreach ($value as $ws)
|
foreach ($value as $ws)
|
||||||
{
|
{
|
||||||
if (!$url = Yggverse\Parser\Url::parse($ws))
|
if (!self::url($ws))
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet web seed URL')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($url->host->name))
|
|
||||||
{
|
|
||||||
array_push(
|
|
||||||
self::$_error,
|
|
||||||
_('Invalid magnet web seed host name')
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
|
||||||
{
|
{
|
||||||
array_push(
|
array_push(
|
||||||
self::$_error,
|
self::$_error,
|
||||||
sprintf(
|
sprintf(
|
||||||
_('Magnet web seed format does not match condition "%s"'),
|
_('Invalid magnet web seed URL "%s"'),
|
||||||
YGGDRASIL_HOST_REGEX
|
$ws
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -900,7 +924,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Magnet comment
|
// Magnet comment
|
||||||
public static function magnetComment(mixed $value)
|
public static function magnetComment(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -933,7 +957,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentId(mixed $value)
|
public static function magnetCommentId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -948,7 +972,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentIdParent(mixed $value)
|
public static function magnetCommentIdParent(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!(is_bool($value) || is_int($value)))
|
if (!(is_bool($value) || is_int($value)))
|
||||||
{
|
{
|
||||||
@ -968,7 +992,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentTimeAdded(mixed $value)
|
public static function magnetCommentTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -993,7 +1017,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentApproved(mixed $value)
|
public static function magnetCommentApproved(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -1008,7 +1032,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentPublic(mixed $value)
|
public static function magnetCommentPublic(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -1023,7 +1047,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetCommentValue(mixed $value)
|
public static function magnetCommentValue(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_string($value))
|
if (!is_string($value))
|
||||||
{
|
{
|
||||||
@ -1054,7 +1078,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Magnet download
|
// Magnet download
|
||||||
public static function magnetDownload(mixed $value)
|
public static function magnetDownload(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -1083,7 +1107,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetDownloadId(mixed $value)
|
public static function magnetDownloadId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -1098,7 +1122,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetDownloadTimeAdded(mixed $value)
|
public static function magnetDownloadTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -1124,7 +1148,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Magnet star
|
// Magnet star
|
||||||
public static function magnetStar(mixed $value)
|
public static function magnetStar(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -1154,7 +1178,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetStarId(mixed $value)
|
public static function magnetStarId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -1169,7 +1193,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetStarValue(mixed $value)
|
public static function magnetStarValue(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_bool($value))
|
if (!is_bool($value))
|
||||||
{
|
{
|
||||||
@ -1184,7 +1208,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetStarTimeAdded(mixed $value)
|
public static function magnetStarTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -1210,7 +1234,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Magnet view
|
// Magnet view
|
||||||
public static function magnetView(mixed $value)
|
public static function magnetView(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_object($value))
|
if (!is_object($value))
|
||||||
{
|
{
|
||||||
@ -1239,7 +1263,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetViewId(mixed $value)
|
public static function magnetViewId(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
@ -1254,7 +1278,7 @@ class Valid
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function magnetViewTimeAdded(mixed $value)
|
public static function magnetViewTimeAdded(mixed $value) : bool
|
||||||
{
|
{
|
||||||
if (!is_int($value))
|
if (!is_int($value))
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'jidenticon':
|
case 'jidenticon':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -79,7 +79,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'approved':
|
case 'approved':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -168,7 +168,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'new':
|
case 'new':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -293,7 +293,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'star':
|
case 'star':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -393,7 +393,7 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'new':
|
case 'new':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -491,9 +491,9 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'tr':
|
case 'tr':
|
||||||
foreach ($value as $tr)
|
foreach ($value as $tr)
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($tr))
|
if (Valid::url($tr))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
if ($url = Yggverse\Parser\Url::parse($tr))
|
||||||
{
|
{
|
||||||
$db->initMagnetToAddressTrackerId(
|
$db->initMagnetToAddressTrackerId(
|
||||||
$magnetId,
|
$magnetId,
|
||||||
@ -517,9 +517,9 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'as':
|
case 'as':
|
||||||
foreach ($value as $as)
|
foreach ($value as $as)
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($as))
|
if (Valid::url($as))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
if ($url = Yggverse\Parser\Url::parse($as))
|
||||||
{
|
{
|
||||||
$db->initMagnetToAcceptableSourceId(
|
$db->initMagnetToAcceptableSourceId(
|
||||||
$magnetId,
|
$magnetId,
|
||||||
@ -537,9 +537,9 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
case 'xs':
|
case 'xs':
|
||||||
foreach ($value as $xs)
|
foreach ($value as $xs)
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($xs))
|
if (Valid::url($xs))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
if ($url = Yggverse\Parser\Url::parse($xs))
|
||||||
{
|
{
|
||||||
$db->initMagnetToExactSourceId(
|
$db->initMagnetToExactSourceId(
|
||||||
$magnetId,
|
$magnetId,
|
||||||
|
@ -16,29 +16,24 @@ $connectionWhiteList = [];
|
|||||||
foreach (json_decode(file_get_contents(__DIR__ . '/../../config/nodes.json')) as $node)
|
foreach (json_decode(file_get_contents(__DIR__ . '/../../config/nodes.json')) as $node)
|
||||||
{
|
{
|
||||||
// Skip non-condition addresses
|
// Skip non-condition addresses
|
||||||
if ($manifestUrl = Yggverse\Parser\Url::parse($node->manifest))
|
if (!Valid::url($node->manifest))
|
||||||
{
|
{
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $manifestUrl->host->name)))
|
$response =
|
||||||
{
|
[
|
||||||
continue;
|
'status' => false,
|
||||||
}
|
'message' => Valid::getError()
|
||||||
}
|
];
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip current host
|
// Skip current host
|
||||||
if ($thisUrl = Yggverse\Parser\Url::parse(WEBSITE_URL))
|
$thisUrl = Yggverse\Parser\Url::parse(WEBSITE_URL);
|
||||||
{
|
$manifestUrl = Yggverse\Parser\Url::parse($node->manifest);
|
||||||
if ($manifestUrl->host->name == $thisUrl->host->name) // @TODO some mirrors could be available, improve condition
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
if (empty($manifestUrl->host->name) ||
|
||||||
|
empty($manifestUrl->host->name) ||
|
||||||
|
$manifestUrl->host->name == $thisUrl->host->name) // @TODO some mirrors could be available, improve condition
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -67,7 +62,7 @@ else if (!API_IMPORT_PUSH_ENABLED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
else if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
else if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response =
|
$response =
|
||||||
[
|
[
|
||||||
|
@ -17,7 +17,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
@ -146,7 +146,7 @@ else
|
|||||||
$uri = $db->getUri($addressTracker->uriId);
|
$uri = $db->getUri($addressTracker->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ else
|
|||||||
$uri = $db->getUri($acceptableSource->uriId);
|
$uri = $db->getUri($acceptableSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ else
|
|||||||
$uri = $db->getUri($eXactSource->uriId);
|
$uri = $db->getUri($eXactSource->uriId);
|
||||||
|
|
||||||
// Yggdrasil host only
|
// Yggdrasil host only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $host->value)))
|
if (!Valid::host($host->value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required to enable resource features');
|
$response->message = _('Yggdrasil connection required to enable resource features');
|
||||||
@ -373,27 +373,22 @@ else {
|
|||||||
|
|
||||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['tr'])) as $tr)
|
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['tr'])) as $tr)
|
||||||
{
|
{
|
||||||
$tr = trim($tr);
|
if (Valid::url($tr))
|
||||||
|
|
||||||
if (!empty($tr))
|
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($tr))
|
if ($url = Yggverse\Parser\Url::parse($tr))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
$db->initMagnetToAddressTrackerId(
|
||||||
{
|
$magnet->magnetId,
|
||||||
$db->initMagnetToAddressTrackerId(
|
$db->initAddressTrackerId(
|
||||||
$magnet->magnetId,
|
$db->initSchemeId($url->host->scheme),
|
||||||
$db->initAddressTrackerId(
|
$db->initHostId($url->host->name),
|
||||||
$db->initSchemeId($url->host->scheme),
|
$db->initPortId($url->host->port),
|
||||||
$db->initHostId($url->host->name),
|
$db->initUriId($url->page->uri)
|
||||||
$db->initPortId($url->host->port),
|
)
|
||||||
$db->initUriId($url->page->uri)
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->form->tr->valid->success = true;
|
$response->form->tr->valid->success = true;
|
||||||
$response->form->tr->valid->message = false;
|
$response->form->tr->valid->message = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,27 +404,22 @@ else {
|
|||||||
|
|
||||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['as'])) as $as)
|
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['as'])) as $as)
|
||||||
{
|
{
|
||||||
$as = trim($as);
|
if (Valid::url($as))
|
||||||
|
|
||||||
if (!empty($as))
|
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($as))
|
if ($url = Yggverse\Parser\Url::parse($as))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
$db->initMagnetToAcceptableSourceId(
|
||||||
{
|
$magnet->magnetId,
|
||||||
$db->initMagnetToAcceptableSourceId(
|
$db->initAcceptableSourceId(
|
||||||
$magnet->magnetId,
|
$db->initSchemeId($url->host->scheme),
|
||||||
$db->initAcceptableSourceId(
|
$db->initHostId($url->host->name),
|
||||||
$db->initSchemeId($url->host->scheme),
|
$db->initPortId($url->host->port),
|
||||||
$db->initHostId($url->host->name),
|
$db->initUriId($url->page->uri)
|
||||||
$db->initPortId($url->host->port),
|
)
|
||||||
$db->initUriId($url->page->uri)
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->form->as->valid->success = true;
|
$response->form->as->valid->success = true;
|
||||||
$response->form->as->valid->message = false;
|
$response->form->as->valid->message = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -445,27 +435,22 @@ else {
|
|||||||
|
|
||||||
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['xs'])) as $xs)
|
foreach (explode(PHP_EOL, str_replace(['#', ',', ' '], PHP_EOL, $_POST['xs'])) as $xs)
|
||||||
{
|
{
|
||||||
$xs = trim($xs);
|
if (Valid::url($xs))
|
||||||
|
|
||||||
if (!empty($xs))
|
|
||||||
{
|
{
|
||||||
if ($url = Yggverse\Parser\Url::parse($xs))
|
if ($url = Yggverse\Parser\Url::parse($xs))
|
||||||
{
|
{
|
||||||
if (preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $url->host->name)))
|
$db->initMagnetToExactSourceId(
|
||||||
{
|
$magnet->magnetId,
|
||||||
$db->initMagnetToExactSourceId(
|
$db->initExactSourceId(
|
||||||
$magnet->magnetId,
|
$db->initSchemeId($url->host->scheme),
|
||||||
$db->initExactSourceId(
|
$db->initHostId($url->host->name),
|
||||||
$db->initSchemeId($url->host->scheme),
|
$db->initPortId($url->host->port),
|
||||||
$db->initHostId($url->host->name),
|
$db->initUriId($url->page->uri)
|
||||||
$db->initPortId($url->host->port),
|
)
|
||||||
$db->initUriId($url->page->uri)
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->form->xs->valid->success = true;
|
$response->form->xs->valid->success = true;
|
||||||
$response->form->xs->valid->message = false;
|
$response->form->xs->valid->message = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
|
@ -23,7 +23,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required to enable resource features');
|
$response->message = _('Yggdrasil connection required to enable resource features');
|
||||||
|
@ -13,7 +13,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required to enable resource features');
|
$response->message = _('Yggdrasil connection required to enable resource features');
|
||||||
|
@ -12,7 +12,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
|
@ -12,7 +12,7 @@ $response = (object)
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR']))
|
if (!Valid::host($_SERVER['REMOTE_ADDR']))
|
||||||
{
|
{
|
||||||
$response->success = false;
|
$response->success = false;
|
||||||
$response->message = _('Yggdrasil connection required for this action');
|
$response->message = _('Yggdrasil connection required for this action');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user