Merge pull request #7606 from annando/fix-invalid-url

Replace not working "redir" link with a working one
This commit is contained in:
Tobias Diekershoff 2019-09-10 06:29:55 +02:00 committed by GitHub
commit 3d5d50a25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -122,7 +122,7 @@ function redir_private_images($a, &$item)
}
if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == Protocol::DFRN)) {
$img_url = 'redir?f=1&quiet=1&url=' . urlencode($mtch[1]) . '&conurl=' . urlencode($item['author-link']);
$img_url = 'redir/' . $item['contact-id'] . '?url=' . urlencode($mtch[1]);
$item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
}
}

View File

@ -2707,8 +2707,10 @@ class Contact extends BaseObject
*/
public static function magicLinkByContact($contact, $url = '')
{
$destination = $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url'];
if ((!local_user() && !remote_user()) || ($contact['network'] != Protocol::DFRN)) {
return $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url'];
return $destination;
}
// Only redirections to the same host do make sense
@ -2721,7 +2723,7 @@ class Contact extends BaseObject
}
if (empty($contact['id'])) {
return $url ?: $contact['url'];
return $destination;
}
$redirect = 'redir/' . $contact['id'];

View File

@ -656,6 +656,8 @@ class Photo extends BaseObject
continue;
}
/// @todo Check if $str_contact_allow does contain a public forum. Then set the permissions to public.
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
$condition = ['resource-id' => $image_uri, 'uid' => $uid];