]> git.mxchange.org Git - friendica.git/blobdiff - include/diaspora.php
* Add MIME types for file attachments
[friendica.git] / include / diaspora.php
index c2b2fbcf4e1a71753b1a140ca1d48e5ba4e9678e..3b681e9918457e135a8b4bf195cea0c17e3dc253 100755 (executable)
@@ -752,7 +752,7 @@ function diaspora_request($importer,$xml) {
 }
 
 function diaspora_post_allow($importer,$contact) {
-       if(($contact['blocked']) || ($contact['readonly']))
+       if(($contact['blocked']) || ($contact['readonly']) || ($contact['archive']))
                return false;
        if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND)
                return true;
@@ -923,6 +923,7 @@ function diaspora_reshare($importer,$xml,$msg) {
        $orig_guid = notags(unxmlify($xml->root_guid));
 
        $source_url = 'https://' . substr($orig_author,strpos($orig_author,'@')+1) . '/p/' . $orig_guid . '.xml';
+       $orig_url = 'https://'.substr($orig_author,strpos($orig_author,'@')+1).'/posts/'.$orig_guid;
        $x = fetch_url($source_url);
        if(! $x)
                $x = fetch_url(str_replace('https://','http://',$source_url));
@@ -959,12 +960,12 @@ function diaspora_reshare($importer,$xml,$msg) {
 
        $person = find_diaspora_person_by_handle($orig_author);
 
-       if(is_array($person) && x($person,'name') && x($person,'url'))
+       /*if(is_array($person) && x($person,'name') && x($person,'url'))
                $details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]';
        else
                $details = $orig_author;
 
-       $prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";
+       $prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";*/
 
 
        // allocate a guid on our system - we aren't fixing any collisions.
@@ -1011,7 +1012,7 @@ function diaspora_reshare($importer,$xml,$msg) {
                        }
                }
        }
-       
+
        $datarray['uid'] = $importer['uid'];
        $datarray['contact-id'] = $contact['id'];
        $datarray['wall'] = 0;
@@ -1023,19 +1024,21 @@ function diaspora_reshare($importer,$xml,$msg) {
        $datarray['owner-name'] = $contact['name'];
        $datarray['owner-link'] = $contact['url'];
        $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
-       if (intval(get_config('system','diaspora_newreshare'))) {
+       if (intval(get_config('system','new_share'))) {
+               $prefix = "[share author='".str_replace("'", "'",$person['name']).
+                               "' profile='".$person['url'].
+                               "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
+                               "' link='".$orig_url."']";
+               $datarray['author-name'] = $contact['name'];
+               $datarray['author-link'] = $contact['url'];
+               $datarray['author-avatar'] = $contact['thumb'];
+               $datarray['body'] = $prefix.$body."[/share]";
+       } else {
                // Let reshared messages look like wall-to-wall posts
-               // we have to set an additional value in the item in the future
-               // to distinct the wall-to-wall-posts from reshared/repeated messages
                $datarray['author-name'] = $person['name'];
                $datarray['author-link'] = $person['url'];
                $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
                $datarray['body'] = $body;
-       } else {
-               $datarray['author-name'] = $contact['name'];
-               $datarray['author-link'] = $contact['url'];
-               $datarray['author-avatar'] = $contact['thumb'];
-               $datarray['body'] = $prefix . $body;
        }
 
        $datarray['tag'] = $str_tags;