]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Friendicaland
[friendica.git] / mod / item.php
index 012f2989b0789dd51bf56238c9723d2c7cd1f199..52ea9d58c90c253c1b969ac593316592c3edb8f8 100644 (file)
@@ -306,6 +306,7 @@ function item_post(&$a) {
 
        $author = null;
        $self   = false;
+       $contact_id = 0;
 
        if((local_user()) && (local_user() == $profile_uid)) {
                $self = true;
@@ -314,9 +315,19 @@ function item_post(&$a) {
                );
        }
        elseif(remote_user()) {
-               $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
-                       intval(remote_user())
-               );
+               if(is_array($_SESSION['remote'])) {
+                       foreach($_SESSION['remote'] as $v) {
+                               if($v['uid'] == $profile_uid) {
+                                       $contact_id = $v['cid'];
+                                       break;
+                               }
+                       }
+               }                               
+               if($contact_id) {
+                       $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
+                               intval($contact_id)
+                       );
+               }
        }
 
        if(count($r)) {
@@ -439,6 +450,7 @@ function item_post(&$a) {
 
        $body = bb_translate_video($body);
 
+
        /**
         * Fold multi-line [code] sequences
         */
@@ -447,6 +459,8 @@ function item_post(&$a) {
 
        $body = scale_external_images($body,false);
 
+
+
        /**
         * Look for any tags and linkify them
         */
@@ -542,6 +556,10 @@ function item_post(&$a) {
 
        $uri = item_new_uri($a->get_hostname(),$profile_uid);
 
+       // Fallback so that we alway have a thr-parent
+       if(!$thr_parent)
+               $thr_parent = $uri;
+
        $datarray = array();
        $datarray['uid']           = $profile_uid;
        $datarray['type']          = $post_type;
@@ -601,7 +619,7 @@ function item_post(&$a) {
 
        if($preview) {
                require_once('include/conversation.php');
-               $o = conversation($a,array(array_merge($contact_record,$datarray)),'search',false,true);
+               $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false, true);
                logger('preview: ' . $o);
                echo json_encode(array('preview' => $o));
                killme();
@@ -741,6 +759,7 @@ function item_post(&$a) {
                                        'verb'         => ACTIVITY_POST,
                                        'otype'        => 'item',
                                        'parent'       => $parent,
+                                       'parent_uri'   => $parent_item['uri']
                                ));
                        
                        }