]> git.mxchange.org Git - friendica.git/blobdiff - include/diaspora.php
Added some more timestamp measuring
[friendica.git] / include / diaspora.php
index 88a8e5e55b86ca3c72a74a15298b69409096219e..1202a3a5521bbc54fae0d0749020deaaac9012a0 100755 (executable)
@@ -833,31 +833,6 @@ function diaspora_post($importer,$xml,$msg) {
 
        $str_tags = '';
 
-       $tags = get_tags($body);
-
-       if(count($tags)) {
-               foreach($tags as $tag) {
-                       if(strpos($tag,'#') === 0) {
-                               if(strpos($tag,'[url='))
-                                       continue;
-
-                               // don't link tags that are already embedded in links
-
-                               if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
-                                       continue;
-                               if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
-                                       continue;
-
-                               $basetag = str_replace('_',' ',substr($tag,1));
-                               $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
-                               if(strlen($str_tags))
-                                       $str_tags .= ',';
-                               $str_tags .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
-                               continue;
-                       }
-               }
-       }
-
        $cnt = preg_match_all('/@\[url=(.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
        if($cnt) {
                foreach($matches as $mtch) {
@@ -946,12 +921,11 @@ function diaspora_store_by_guid($guid, $server) {
                dbesc($guid)
        );
        if(count($r))
-                return $r[0]["id"];
+               return $r[0]["id"];
 
        $person = find_diaspora_person_by_handle($author);
 
         $datarray = array();
-
        $datarray['uid'] = 0;
        $datarray['contact-id'] = get_contact($person['url'], 0);
        $datarray['wall'] = 0;
@@ -1055,34 +1029,8 @@ function diaspora_fetch_message($guid, $server, $level = 0) {
                return false;
 
        $item["tag"] = '';
-
-       $tags = get_tags($body);
-
-       if(count($tags)) {
-               foreach($tags as $tag) {
-                       if(strpos($tag,'#') === 0) {
-                               if(strpos($tag,'[url='))
-                                       continue;
-
-                               // don't link tags that are already embedded in links
-
-                               if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
-                                       continue;
-                               if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
-                                       continue;
-
-
-                               $basetag = str_replace('_',' ',substr($tag,1));
-                               $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
-                               if(strlen($item["tag"]))
-                                       $item["tag"] .= ',';
-                               $item["tag"] .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
-                               continue;
-                       }
-               }
-       }
-
        $item["body"] = $body;
+
        return $item;
 }
 
@@ -1219,6 +1167,8 @@ function diaspora_reshare($importer,$xml,$msg) {
                $prefix = "[share author='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$person['name']).
                                "' profile='".$person['url'].
                                "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
+                               "' guid='".$orig_guid.
+                               "' posted='".$orig_created.
                                "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$orig_url)."']";
                $datarray['author-name'] = $contact['name'];
                $datarray['author-link'] = $contact['url'];
@@ -1482,34 +1432,6 @@ function diaspora_comment($importer,$xml,$msg) {
 
        $datarray = array();
 
-       $str_tags = '';
-
-       $tags = get_tags($body);
-
-       if(count($tags)) {
-               foreach($tags as $tag) {
-                       if(strpos($tag,'#') === 0) {
-                               if(strpos($tag,'[url='))
-                                       continue;
-
-                               // don't link tags that are already embedded in links
-
-                               if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
-                                       continue;
-                               if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
-                                       continue;
-
-
-                               $basetag = str_replace('_',' ',substr($tag,1));
-                               $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
-                               if(strlen($str_tags))
-                                       $str_tags .= ',';
-                               $str_tags .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
-                               continue;
-                       }
-               }
-       }
-
        $datarray['uid'] = $importer['uid'];
        $datarray['contact-id'] = $contact['id'];
        $datarray['type'] = 'remote-comment';
@@ -1533,7 +1455,6 @@ function diaspora_comment($importer,$xml,$msg) {
        $datarray['author-link'] = $person['url'];
        $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
        $datarray['body'] = $body;
-       $datarray['tag'] = $str_tags;
 
        // We can't be certain what the original app is if the message is relayed.
        if(($parent_item['origin']) && (! $parent_author_signature))
@@ -2399,7 +2320,7 @@ function diaspora_profile($importer,$xml,$msg) {
        if (unxmlify($xml->searchable) == "true") {
                require_once('include/socgraph.php');
                poco_check($contact['url'], $name, NETWORK_DIASPORA, $images[0], $about, $location, $gender, $keywords, "",
-                       datetime_convert(), $contact['id'], $importer['uid']);
+                       datetime_convert(), 2, $contact['id'], $importer['uid']);
        }
 
        $profileurl = "";