]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1502-contacts-in-scrape
authorMichael Vogel <icarus@dabo.de>
Mon, 9 Feb 2015 09:16:48 +0000 (10:16 +0100)
committerMichael Vogel <icarus@dabo.de>
Mon, 9 Feb 2015 09:16:48 +0000 (10:16 +0100)
boot.php
mod/noscrape.php
view/templates/profile_vcard.tpl
view/theme/vier/templates/profile_vcard.tpl

index c136dc57441b5bcfaca0eebb005adb5b666241bc..696928145fdd3d37b285850c6e4112266418ee53 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1678,8 +1678,20 @@ if(! function_exists('profile_sidebar')) {
 
                if (!$block){
                        $contact_block = contact_block();
-               }
 
+                       if(is_array($a->profile) AND !$a->profile['hide-friends']) {
+                               $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
+                                               AND `network` IN ('%s', '%s', '%s', '%s', '')",
+                                       intval($a->profile['uid']),
+                                       dbesc(NETWORK_DFRN),
+                                       dbesc(NETWORK_DIASPORA),
+                                       dbesc(NETWORK_OSTATUS),
+                                       dbesc(NETWORK_STATUSNET)
+                               );
+                               if(count($r))
+                                       $contacts = intval($r[0]['total']);
+                       }
+               }
 
                $p = array();
                foreach($profile as $k => $v) {
@@ -1704,6 +1716,7 @@ if(! function_exists('profile_sidebar')) {
                        '$homepage' => $homepage,
                        '$about' => $about,
                        '$network' =>  t('Network:'),
+                       '$contacts' => $contacts,
                        '$diaspora' => $diaspora,
                        '$contact_block' => $contact_block,
                ));
index 10df72eeb869f33238e14e966dfa11b8df3231ea..a93abd29a8b546154e35124e668b8021bdc73c08 100644 (file)
@@ -31,6 +31,19 @@ function noscrape_init(&$a) {
                'tags' => $keywords
        );
 
+       if(is_array($a->profile) AND !$a->profile['hide-friends']) {
+               $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
+                               AND `network` IN ('%s', '%s', '%s', '%s', '')",
+                       intval($a->profile['uid']),
+                       dbesc(NETWORK_DFRN),
+                       dbesc(NETWORK_DIASPORA),
+                       dbesc(NETWORK_OSTATUS),
+                       dbesc(NETWORK_STATUSNET)
+               );
+               if(count($r))
+                       $json_info["contacts"] = intval($r[0]['total']);
+       }
+
        //These are optional fields.
        $profile_fields = array('pdesc', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital', 'about');
        foreach($profile_fields as $field)
index 9bbb7f8a42d2f97b60ea4fdb4a4d68ae7c8b3a72..097d44cc3bd5986fab090968ea5308d6cd95aac7 100644 (file)
@@ -31,6 +31,8 @@
        
        {{if $profile.pubkey}}<div class="key u-key" style="display:none;">{{$profile.pubkey}}</div>{{/if}}
 
+       {{if $contacts}}<div class="contacts" style="display:none;">{{$contacts}}</div>{{/if}}
+
        {{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}}
 
        {{if $homepage}}<dl class="homepage"><dt class="homepage-label">{{$homepage}}</dt><dd class="homepage-url u-url"><a href="{{$profile.homepage}}" rel="me" target="_blank">{{$profile.homepage}}</a></dd></dl>{{/if}}
index 9d0c65601ab6e52a1e4215bbcb67bdb9979177b8..ca5f44cf1ca5302a652893f832001ec72b70051e 100644 (file)
@@ -40,6 +40,8 @@
        
        {{if $profile.pubkey}}<div class="key" style="display:none;">{{$profile.pubkey}}</div>{{/if}}
 
+       {{if $contacts}}<div class="contacts" style="display:none;">{{$contacts}}</div>{{/if}}
+
        {{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}}
 
        {{if $homepage}}<dl class="homepage"><dt class="homepage-label">{{$homepage}}</dt><dd class="homepage-url"><a href="{{$profile.homepage}}" class="u-url" rel="me" target="_blank">{{$profile.homepage}}</a></dd></dl>{{/if}}