]> git.mxchange.org Git - friendica.git/commitdiff
Scrape now contains the number of contacts as well.
authorMichael Vogel <icarus@dabo.de>
Sun, 8 Feb 2015 22:35:29 +0000 (23:35 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 8 Feb 2015 22:35:29 +0000 (23:35 +0100)
boot.php
mod/noscrape.php
view/templates/profile_vcard.tpl
view/theme/vier/templates/profile_vcard.tpl

index dd6bc6ac5d6f6c58b9fcb7ca28a0c7898dcde193..96b19add134b5a6f29f4d9f53a6047b4bc7b06e3 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1673,8 +1673,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) {
@@ -1699,6 +1711,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}}