mirror of
https://github.com/friendica/friendica
synced 2024-11-13 14:22:54 +00:00
Merge pull request #8435 from annando/issue-8371-a
Issue 8371: Alternate Solution
This commit is contained in:
commit
7d1e0a72c1
3 changed files with 29 additions and 25 deletions
|
@ -244,10 +244,10 @@ function item_post(App $a) {
|
||||||
$body = preg_replace('#\[url=([^\]]*?)\]\[/url\]#ism', '[url]$1[/url]', $body);
|
$body = preg_replace('#\[url=([^\]]*?)\]\[/url\]#ism', '[url]$1[/url]', $body);
|
||||||
|
|
||||||
if (!empty($orig_post)) {
|
if (!empty($orig_post)) {
|
||||||
$str_group_allow = $orig_post['allow_gid'] ?? '';
|
$str_group_allow = $orig_post['allow_gid'];
|
||||||
$str_contact_allow = $orig_post['allow_cid'] ?? '';
|
$str_contact_allow = $orig_post['allow_cid'];
|
||||||
$str_group_deny = $orig_post['deny_gid'] ?? '';
|
$str_group_deny = $orig_post['deny_gid'];
|
||||||
$str_contact_deny = $orig_post['deny_cid'] ?? '';
|
$str_contact_deny = $orig_post['deny_cid'];
|
||||||
$location = $orig_post['location'];
|
$location = $orig_post['location'];
|
||||||
$coord = $orig_post['coord'];
|
$coord = $orig_post['coord'];
|
||||||
$verb = $orig_post['verb'];
|
$verb = $orig_post['verb'];
|
||||||
|
|
|
@ -44,6 +44,7 @@ use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use Friendica\Worker\Delivery;
|
use Friendica\Worker\Delivery;
|
||||||
use Text_LanguageDetect;
|
use Text_LanguageDetect;
|
||||||
|
use Friendica\Repository\PermissionSet as RepPermissionSet;
|
||||||
|
|
||||||
class Item
|
class Item
|
||||||
{
|
{
|
||||||
|
@ -326,6 +327,21 @@ class Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($row['internal-psid'] == RepPermissionSet::PUBLIC) {
|
||||||
|
if (array_key_exists('allow_cid', $row)) {
|
||||||
|
$row['allow_cid'] = '';
|
||||||
|
}
|
||||||
|
if (array_key_exists('allow_gid', $row)) {
|
||||||
|
$row['allow_gid'] = '';
|
||||||
|
}
|
||||||
|
if (array_key_exists('deny_cid', $row)) {
|
||||||
|
$row['deny_cid'] = '';
|
||||||
|
}
|
||||||
|
if (array_key_exists('deny_gid', $row)) {
|
||||||
|
$row['deny_gid'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
|
if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
|
||||||
$row['signed_text'] = $row['interaction'];
|
$row['signed_text'] = $row['interaction'];
|
||||||
}
|
}
|
||||||
|
@ -338,6 +354,7 @@ class Item
|
||||||
unset($row['internal-activity']);
|
unset($row['internal-activity']);
|
||||||
unset($row['internal-network']);
|
unset($row['internal-network']);
|
||||||
unset($row['internal-iid']);
|
unset($row['internal-iid']);
|
||||||
|
unset($row['internal-psid']);
|
||||||
unset($row['internal-iaid']);
|
unset($row['internal-iaid']);
|
||||||
unset($row['internal-icid']);
|
unset($row['internal-icid']);
|
||||||
unset($row['internal-user-ignored']);
|
unset($row['internal-user-ignored']);
|
||||||
|
@ -664,7 +681,7 @@ class Item
|
||||||
'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global',
|
'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global',
|
||||||
'id' => 'item_id', 'network', 'icid', 'iaid', 'id' => 'internal-iid',
|
'id' => 'item_id', 'network', 'icid', 'iaid', 'id' => 'internal-iid',
|
||||||
'network' => 'internal-network', 'icid' => 'internal-icid',
|
'network' => 'internal-network', 'icid' => 'internal-icid',
|
||||||
'iaid' => 'internal-iaid'];
|
'iaid' => 'internal-iaid', 'psid' => 'internal-psid'];
|
||||||
|
|
||||||
if ($usermode) {
|
if ($usermode) {
|
||||||
$fields['user-item'] = ['pinned', 'notification-type', 'ignored' => 'internal-user-ignored'];
|
$fields['user-item'] = ['pinned', 'notification-type', 'ignored' => 'internal-user-ignored'];
|
||||||
|
@ -833,6 +850,7 @@ class Item
|
||||||
{
|
{
|
||||||
if (!empty($selected)) {
|
if (!empty($selected)) {
|
||||||
$selected[] = 'internal-iid';
|
$selected[] = 'internal-iid';
|
||||||
|
$selected[] = 'internal-psid';
|
||||||
$selected[] = 'internal-iaid';
|
$selected[] = 'internal-iaid';
|
||||||
$selected[] = 'internal-icid';
|
$selected[] = 'internal-icid';
|
||||||
$selected[] = 'internal-network';
|
$selected[] = 'internal-network';
|
||||||
|
|
|
@ -298,14 +298,6 @@ class Photo
|
||||||
$backend_ref = $storage->put($Image->asString(), $backend_ref);
|
$backend_ref = $storage->put($Image->asString(), $backend_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent "null" permissions
|
|
||||||
if (!empty($uid)) {
|
|
||||||
$allow_cid = $allow_cid ?? '<' . $uid . '>';
|
|
||||||
$allow_gid = $allow_gid ?? '';
|
|
||||||
$deny_cid = $deny_cid ?? '';
|
|
||||||
$deny_gid = $deny_gid ?? '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
"uid" => $uid,
|
"uid" => $uid,
|
||||||
"contact-id" => $cid,
|
"contact-id" => $cid,
|
||||||
|
@ -662,20 +654,13 @@ class Photo
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI::pConfig()->get($uid, 'system', 'accessible-photos')) {
|
|
||||||
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
|
||||||
Logger::info('Set accessibility', ['condition' => $condition]);
|
|
||||||
Photo::update(['accessible' => true], $condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure to only modify photos that you own
|
// Ensure to only modify photos that you own
|
||||||
$srch = '<' . intval($original_contact_id) . '>';
|
$srch = '<' . intval($original_contact_id) . '>';
|
||||||
|
|
||||||
$condition = ["(`allow_cid` = ? OR `allow_cid` IS NULL) AND
|
$condition = [
|
||||||
(`allow_gid` = ? OR `allow_gid` IS NULL) AND
|
'allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
|
||||||
(`deny_cid` = ? OR `deny_cid` IS NULL) AND
|
'resource-id' => $image_rid, 'uid' => $uid
|
||||||
(`deny_gid` = ? OR `deny_gid` IS NULL) AND
|
];
|
||||||
`resource-id` = ? AND `uid` =?", $srch, '', '', '', $image_rid, $uid];
|
|
||||||
if (!Photo::exists($condition)) {
|
if (!Photo::exists($condition)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -688,7 +673,8 @@ class Photo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
$fields = ['allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
|
||||||
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny];
|
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,
|
||||||
|
'accessible' => DI::pConfig()->get($uid, 'system', 'accessible-photos', false)];
|
||||||
|
|
||||||
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
$condition = ['resource-id' => $image_rid, 'uid' => $uid];
|
||||||
Logger::info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
|
Logger::info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
|
||||||
|
|
Loading…
Reference in a new issue