X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=51bbc76e7270b54151ba3dbc567c0439864c4540;hb=5f2028b657332c7dceb1e14dc0e1cd175fc61a7c;hp=20dc9dfdae892a94a22da257dff8f9b235d28f60;hpb=d7d44e1af7f140b536aa1042f7f8a44f574647c3;p=friendica.git diff --git a/mod/item.php b/mod/item.php index 20dc9dfdae..51bbc76e72 100644 --- a/mod/item.php +++ b/mod/item.php @@ -163,7 +163,7 @@ function item_post(App $a) { } // Allow commenting if it is an answer to a public post - $allow_comment = local_user() && ($profile_uid == 0) && $toplevel_item_id && in_array($toplevel_item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]); + $allow_comment = local_user() && ($profile_uid == 0) && $toplevel_item_id && in_array($toplevel_item['network'], Protocol::FEDERATED); // Now check that valid personal details have been provided if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) { @@ -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. */ @@ -868,7 +835,7 @@ function item_post(App $a) { // When we are doing some forum posting via ! we have to start the notifier manually. // These kind of posts don't initiate the notifier call in the item class. if ($only_to_forum) { - Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post_id); + Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => false], "Notifier", Delivery::POST, $post_id); } Logger::log('post_complete');