From 8fc8e26e23fee2e083efc5568794312f6c481369 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 9 Sep 2019 21:37:26 +0000 Subject: [PATCH 1/2] Replace not working "redir" link with a working one --- include/text.php | 2 +- src/Model/Photo.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 3d6bf6a56..2050e5702 100644 --- a/include/text.php +++ b/include/text.php @@ -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']); } } diff --git a/src/Model/Photo.php b/src/Model/Photo.php index e722444b1..11721c81f 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -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]; From 0a0a961c52287c5a4f5d04d760eef1aab9c77774 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 10 Sep 2019 04:04:07 +0000 Subject: [PATCH 2/2] The value is used twice, so use a variable --- src/Model/Contact.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index ffdee6aa0..cb79e0329 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2700,8 +2700,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 @@ -2714,7 +2716,7 @@ class Contact extends BaseObject } if (empty($contact['id'])) { - return $url ?: $contact['url']; + return $destination; } $redirect = 'redir/' . $contact['id'];