X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=935b50d03050d4ab38b4a99fbe0205f5bd69e159;hb=796056a6feaf305dd9fb7c97bb43cdbc75ad0641;hp=a6a3a50c801644ab06b66f1bb16059f9821ebf6c;hpb=ff5ee74ecfbd39b630433c6e1d7cfcd9611d4660;p=friendica.git diff --git a/mod/item.php b/mod/item.php index a6a3a50c80..935b50d030 100644 --- a/mod/item.php +++ b/mod/item.php @@ -219,10 +219,10 @@ function item_post(App $a) { $str_contact_deny = $user['deny_cid']; } else { // use the posted permissions - $str_group_allow = perms2str($_REQUEST['group_allow']); - $str_contact_allow = perms2str($_REQUEST['contact_allow']); - $str_group_deny = perms2str($_REQUEST['group_deny']); - $str_contact_deny = perms2str($_REQUEST['contact_deny']); + $str_group_allow = perms2str(defaults($_REQUEST, 'group_allow', '')); + $str_contact_allow = perms2str(defaults($_REQUEST, 'contact_allow', '')); + $str_group_deny = perms2str(defaults($_REQUEST, 'group_deny', '')); + $str_contact_deny = perms2str(defaults($_REQUEST, 'contact_deny', '')); } $title = notags(trim(defaults($_REQUEST, 'title' , ''))); @@ -232,7 +232,7 @@ function item_post(App $a) { $emailcc = notags(trim(defaults($_REQUEST, 'emailcc' , ''))); $body = escape_tags(trim(defaults($_REQUEST, 'body' , ''))); $network = notags(trim(defaults($_REQUEST, 'network' , NETWORK_DFRN))); - $guid = get_guid(32); + $guid = System::createGUID(32); $postopts = defaults($_REQUEST, 'postopts', ''); @@ -245,7 +245,6 @@ function item_post(App $a) { // If this is a comment, set the permissions from the parent. if ($parent_item) { - // for non native networks use the network of the original post as network of the item if (($parent_item['network'] != NETWORK_DIASPORA) && ($parent_item['network'] != NETWORK_OSTATUS) @@ -651,16 +650,18 @@ function item_post(App $a) { $conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]); if (DBM::is_result($conversation)) { - if ($r['conversation-uri'] != '') { + if ($conversation['conversation-uri'] != '') { $datarray['conversation-uri'] = $conversation['conversation-uri']; } - if ($r['conversation-href'] != '') { + if ($conversation['conversation-href'] != '') { $datarray['conversation-href'] = $conversation['conversation-href']; } } if ($orig_post) { $datarray['edit'] = true; + } else { + $datarray['edit'] = false; } // Check for hashtags in the body and repair or add hashtag links @@ -674,6 +675,9 @@ function item_post(App $a) { // We set the datarray ID to -1 because in preview mode the dataray // doesn't have an ID. $datarray["id"] = -1; + $datarray["item_id"] = -1; + $datarray["author-network"] = NETWORK_DFRN; + $o = conversation($a,[array_merge($contact_record,$datarray)],'search', false, true); logger('preview: ' . $o); echo json_encode(['preview' => $o]);