From 532b479f96eea701080d5533e5f28acab9af76ba Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 14 Oct 2021 18:15:38 +0000 Subject: provide local copies of the w3.org jsonld documents - addresses issue #1637 --- include/network.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 194b50885..1b8f0e663 100644 --- a/include/network.php +++ b/include/network.php @@ -2014,6 +2014,21 @@ function getBestSupportedMimeType($mimeTypes = null, $acceptedTypes = false) { */ function jsonld_document_loader($url) { + switch ($url) { + case 'https://www.w3.org/ns/activitystreams': + $url = z_root() . '/library/w3org/activitystreams.jsonld'; + break; + case 'https://w3id.org/identity/v1': + $url = z_root() . '/library/w3org/identity-v1.jsonld'; + break; + case 'https://w3id.org/security/v1': + $url = z_root() . '/library/w3org/security-v1.jsonld'; + break; + default: + logger('URL: ' . $url, LOGGER_DEBUG); + break; + } + require_once('library/jsonld/jsonld.php'); $recursion = 0; @@ -2026,12 +2041,12 @@ function jsonld_document_loader($url) { } } } + if($recursion > 5) { logger('jsonld bomb detected at: ' . $url); killme(); } - $cachepath = 'store/[data]/ldcache'; if(! is_dir($cachepath)) os_mkdir($cachepath, STORAGE_DEFAULT_PERMISSIONS, true); -- cgit v1.2.3