mirror of
https://github.com/friendica/friendica
synced 2025-09-04 20:09:55 +02:00
Merge pull request #7458 from annando/fix-7449
Fix issue 7449: Image permissions are now set like before
This commit is contained in:
commit
e5321ecc7f
2 changed files with 59 additions and 35 deletions
37
mod/item.php
37
mod/item.php
|
@ -469,43 +469,10 @@ function item_post(App $a) {
|
|||
|
||||
$match = null;
|
||||
|
||||
/// @todo these lines should be moved to Model/Photo
|
||||
if (!$preview && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) {
|
||||
$images = $match[2];
|
||||
if (count($images)) {
|
||||
|
||||
$objecttype = ACTIVITY_OBJ_IMAGE;
|
||||
|
||||
foreach ($images as $image) {
|
||||
if (!stristr($image, System::baseUrl() . '/photo/')) {
|
||||
continue;
|
||||
}
|
||||
$image_uri = substr($image,strrpos($image,'/') + 1);
|
||||
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
|
||||
if (!strlen($image_uri)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure to only modify photos that you own
|
||||
$srch = '<' . intval($original_contact_id) . '>';
|
||||
|
||||
$condition = [
|
||||
'allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
|
||||
'resource-id' => $image_uri, 'uid' => $profile_uid
|
||||
];
|
||||
if (!Photo::exists($condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$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' => $profile_uid];
|
||||
Photo::update($fields, $condition);
|
||||
}
|
||||
}
|
||||
if (!$preview && Photo::setPermissionFromBody($body, $profile_uid, $original_contact_id, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)) {
|
||||
$objecttype = ACTIVITY_OBJ_IMAGE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Next link in any attachment references we find in the post.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue