Link sanitation added to some more places

This commit is contained in:
Michael 2024-02-12 05:40:09 +00:00
parent 061f43788c
commit 3b0cc45588
2 changed files with 13 additions and 13 deletions

View file

@ -125,7 +125,7 @@ class BBCode
break;
case 'publisher_url':
$data['provider_url'] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
$data['provider_url'] = Network::sanitizeUrl(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
break;
case 'author_name':
@ -136,7 +136,7 @@ class BBCode
break;
case 'author_url':
$data['author_url'] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
$data['author_url'] = Network::sanitizeUrl(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
if ($data['provider_url'] == $data['author_url']) {
$data['author_url'] = '';
}

View file

@ -274,13 +274,13 @@ class ParseUrl
$siteinfo['author_name'] = trim($oembed_data->author_name);
}
if (!empty($oembed_data->author_url)) {
$siteinfo['author_url'] = trim($oembed_data->author_url);
$siteinfo['author_url'] = Network::sanitizeUrl($oembed_data->author_url);
}
if (!empty($oembed_data->provider_name)) {
$siteinfo['publisher_name'] = trim($oembed_data->provider_name);
}
if (!empty($oembed_data->provider_url)) {
$siteinfo['publisher_url'] = trim($oembed_data->provider_url);
$siteinfo['publisher_url'] = Network::sanitizeUrl($oembed_data->provider_url);
}
if (!empty($oembed_data->thumbnail_url)) {
$siteinfo['image'] = $oembed_data->thumbnail_url;
@ -884,7 +884,7 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'publisher', 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_url'] = trim($content);
$jsonldinfo['publisher_url'] = Network::sanitizeUrl($content);
}
$brand = JsonLD::fetchElement($jsonld, 'publisher', 'brand', '@type', 'Organization');
@ -896,7 +896,7 @@ class ParseUrl
$content = JsonLD::fetchElement($brand, 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_url'] = trim($content);
$jsonldinfo['publisher_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($brand, 'logo', 'url');
@ -924,12 +924,12 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'author', 'sameAs');
if (!empty($content) && is_string($content)) {
$jsonldinfo['author_url'] = trim($content);
$jsonldinfo['author_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($jsonld, 'author', 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['author_url'] = trim($content);
$jsonldinfo['author_url'] = Network::sanitizeUrl($content);
}
$logo = JsonLD::fetchElement($jsonld, 'author', 'logo');
@ -1084,7 +1084,7 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_url'] = trim($content);
$jsonldinfo['publisher_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($jsonld, 'thumbnailUrl');
@ -1123,7 +1123,7 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_url'] = trim($content);
$jsonldinfo['publisher_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($jsonld, 'logo', 'url', '@type', 'ImageObject');
@ -1140,7 +1140,7 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'brand', 'url', '@type', 'Organization');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_url'] = trim($content);
$jsonldinfo['publisher_url'] = Network::sanitizeUrl($content);
}
Logger::info('Fetched Organization information', ['url' => $siteinfo['url'], 'fetched' => $jsonldinfo]);
@ -1172,12 +1172,12 @@ class ParseUrl
$content = JsonLD::fetchElement($jsonld, 'sameAs');
if (!empty($content) && is_string($content)) {
$jsonldinfo['author_url'] = trim($content);
$jsonldinfo['author_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($jsonld, 'url');
if (!empty($content) && is_string($content)) {
$jsonldinfo['author_url'] = trim($content);
$jsonldinfo['author_url'] = Network::sanitizeUrl($content);
}
$content = JsonLD::fetchElement($jsonld, 'image', 'url', '@type', 'ImageObject');