]> git.mxchange.org Git - friendica.git/blobdiff - mod/follow.php
collapse posts by same author (but not you).
[friendica.git] / mod / follow.php
index 763ffb1b01c456e436057d9cfe72f94324273974..4ce3ccb82c0188440191fb0df60ee6d4b8dc64b0 100644 (file)
@@ -11,7 +11,7 @@ function follow_post(&$a) {
        }
 
        $url = $orig_url = notags(trim($_POST['url']));
-       
+       $diaspora = false;      
        $email_conversant = false;
 
        if($url) {
@@ -28,6 +28,9 @@ function follow_post(&$a) {
                                        $hcard = unamp($link['@attributes']['href']);
                                if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
                                        $profile = unamp($link['@attributes']['href']);
+                               if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location')
+                                       $diaspora = true;
+
 
                        }
 
@@ -84,15 +87,18 @@ function follow_post(&$a) {
                // Google doesn't use absolute url in profile photos
 
                if((x($vcard,'photo')) && substr($vcard['photo'],0,1) == '/') {
-                       $h = parse_url($hcard);
+                       $h = @parse_url($hcard);
                        if($h)
                                $vcard['photo'] = $h['scheme'] . '://' . $h['host'] . $vcard['photo'];
                }
        }
 
-       if(! $profile)
-               $profile = $url;
-
+       if(! $profile) {
+               if($diaspora)
+                       $profile = $hcard;
+               else
+                       $profile = $url;
+       }
 
        if(! x($vcard,'fn'))
                if(x($vcard,'nick'))
@@ -117,6 +123,10 @@ function follow_post(&$a) {
                        $author = $feed->get_author();
                        if($author) {                   
                                $vcard['fn'] = unxmlify(trim($author->get_name()));
+                               if(! $vcard['fn'])
+                                       $vcard['fn'] = trim(unxmlify($author->get_email()));
+                               if(strpos($vcard['fn'],'@') !== false)
+                                       $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
                                $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
                                if(strpos($vcard['nick'],' '))
                                        $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
@@ -249,9 +259,7 @@ function follow_post(&$a) {
 
        // pull feed and consume it, which should subscribe to the hub.
 
-       $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-       //proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
-       proc_run($php_path,"include/poller.php","$contact_id");
+       proc_run('php',"include/poller.php","$contact_id");
 
        // create a follow slap