Create new Contact\Redir module class

- Move /redir route to /contact/redir
This commit is contained in:
Hypolite Petovan 2022-11-08 19:33:08 -05:00
parent 386c08aa05
commit 4a626ef101
14 changed files with 241 additions and 164 deletions

View file

@ -146,7 +146,7 @@ class Conversation
'url' => $activity['author-link']
];
$url = Contact::magicLinkByContact($author);
if (strpos($url, 'redir/') === 0) {
if (strpos($url, 'contact/redir/') === 0) {
$sparkle = ' class="sparkle" ';
}
@ -612,7 +612,7 @@ class Conversation
$profile_link = Contact::magicLinkByContact($author);
$sparkle = '';
if (strpos($profile_link, 'redir/') === 0) {
if (strpos($profile_link, 'contact/redir/') === 0) {
$sparkle = ' sparkle';
}

View file

@ -345,7 +345,7 @@ class Item
'url' => $item['author-link'],
];
$profile_link = Contact::magicLinkByContact($author, $item['author-link']);
$sparkle = (strpos($profile_link, 'redir/') === 0);
$sparkle = (strpos($profile_link, 'contact/redir/') === 0);
$cid = 0;
$pcid = $item['author-id'];

View file

@ -2090,7 +2090,7 @@ class BBCode
$text = preg_replace('/\<([^>]*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism', '<$1$2=$3&$4>', $text);
// sanitizes src attributes (http and redir URLs for displaying in a web page, cid used for inline images in emails)
$allowed_src_protocols = ['//', 'http://', 'https://', 'redir/', 'cid:'];
$allowed_src_protocols = ['//', 'http://', 'https://', 'contact/redir/', 'cid:'];
array_walk($allowed_src_protocols, function(&$value) { $value = preg_quote($value, '#');});
@ -2105,7 +2105,7 @@ class BBCode
$allowed_link_protocols[] = '//';
$allowed_link_protocols[] = 'http://';
$allowed_link_protocols[] = 'https://';
$allowed_link_protocols[] = 'redir/';
$allowed_link_protocols[] = 'contact/redir/';
array_walk($allowed_link_protocols, function(&$value) { $value = preg_quote($value, '#');});

View file

@ -840,7 +840,7 @@ class HTML
if ($redirect) {
$url = Contact::magicLinkByContact($contact);
if (strpos($url, 'redir/') === 0) {
if (strpos($url, 'contact/redir/') === 0) {
$sparkle = ' sparkle';
}
}