$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' , '')));
$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', '');
// 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)
$notify_type = ($parent ? 'comment-new' : 'wall-new');
- $uri = ($message_id ? $message_id : Item::newURI($profile_uid, $guid));
+ $uri = ($message_id ? $message_id : Item::newURI($api_source ? $profile_uid : $uid, $guid));
// Fallback so that we alway have a parent uri
if (!$thr_parent_uri || !$parent) {
$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
// 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]);