]> git.mxchange.org Git - friendica.git/commitdiff
more api tweaks
authorFriendika <info@friendika.com>
Fri, 5 Aug 2011 12:17:18 +0000 (05:17 -0700)
committerFriendika <info@friendika.com>
Fri, 5 Aug 2011 12:17:18 +0000 (05:17 -0700)
include/api.php
view/api_user_xml.tpl

index ffdcdfdd664c17ceb34ebcb72ce27f32eaad8799..6cd3318ef2e2a170185752f852927dbbbb8e255d 100644 (file)
                }
                
                if($uinfo[0]['self']) {
+                       $usr = q("select * from user where uid = %d limit 1",
+                               intval(local_user())
+                       );
+                       $profile = q("select * from profile where uid = %d and `is-default` = 1 limit 1",
+                               intval(local_user())
+                       );
+
                        // count public wall messages
                        $r = q("SELECT COUNT(`id`) as `count` FROM `item`
                                        WHERE  `uid` = %d
                );
                $countfollowers = $r[0]['count'];
 
+               $r = q("SELECT count(`id`) as `count` FROM item where starred = 1 and uid = %d and deleted = 0",
+                       intval($uinfo[0]['uid'])
+               );
+               $starred = $r[0]['count'];
+       
+
                if(! $uinfo[0]['self']) {
                        $countfriends = 0;
                        $countfollowers = 0;
+                       $starred = 0;
                }
 
                $ret = Array(
                        'id' => intval($uinfo[0]['cid']),
                        'name' => $uinfo[0]['name'],
                        'screen_name' => $uinfo[0]['nick'],
-                       'location' => '', //$uinfo[0]['default-location'],
+                       'location' => ($usr) ? $usr[0]['default-location'] : '',
                        'profile_image_url' => $uinfo[0]['micro'],
                        'url' => $uinfo[0]['url'],
                        'contact_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
-                       'protected' => false,   #
+                       'protected' => false,   
                        'friends_count' => intval($countfriends),
                        'created_at' => api_date($uinfo[0]['name-date']),
-                       'utc_offset' => 0, #XXX: fix me
-                       'time_zone' => '', //$uinfo[0]['timezone'],
+                       'utc_offset' => "+00:00",
+                       'time_zone' => 'UTC', //$uinfo[0]['timezone'],
                        'geo_enabled' => false,
                        'statuses_count' => intval($countitms), #XXX: fix me 
                        'lang' => 'en', #XXX: fix me
-                       'description' => '',
-                       'followers_count' => intval($countfollowers), #XXX: fix me
-                       'favourites_count' => 0,
+                       'description' => (($profile) ? $profile[0]['pdesc'] : ''),
+                       'followers_count' => intval($countfollowers),
+                       'favourites_count' => intval($starred),
                        'contributors_enabled' => false,
                        'follow_request_sent' => false,
                        'profile_background_color' => 'cfe8f6',
                        'profile_background_tile' => false,
                        'profile_use_background_image' => false,
                        'notifications' => false,
+                       'following' => '', #XXX: fix me
                        'verified' => true, #XXX: fix me
-                       'followers' => '', #XXX: fix me
                        #'status' => null
                );
        
index 15517fc42e488d9d3430f117764f16389b7bfd06..78cc1f53062440fddb29920453a56b6174898cac 100644 (file)
@@ -7,7 +7,7 @@
   <profile_image_url>$user.profile_image_url</profile_image_url>
   <url>$user.url</url>
   <protected>$user.protected</protected>
-  <followers_count>$user.followers</followers_count>
+  <followers_count>$user.followers_count</followers_count>
   <profile_background_color>$user.profile_background_color</profile_background_color>
   <profile_text_color>$user.profile_text_color</profile_text_color>
   <profile_link_color>$user.profile_link_color</profile_link_color>
   <profile_background_image_url>$user.profile_background_image_url</profile_background_image_url>
   <profile_background_tile>$user.profile_background_tile</profile_background_tile>
   <profile_use_background_image>$user.profile_use_background_image</profile_use_background_image>
-  <notifications></notifications>
+  <notifications>$user.notifications</notifications>
   <geo_enabled>$user.geo_enabled</geo_enabled>
   <verified>$user.verified</verified>
-  <following></following>
+  <following>$user.following</following>
   <statuses_count>$user.statuses_count</statuses_count>
   <lang>$user.lang</lang>
   <contributors_enabled>$user.contributors_enabled</contributors_enabled>