diff options
-rw-r--r-- | include/api.php | 30 | ||||
-rw-r--r-- | view/api_user_xml.tpl | 6 |
2 files changed, 25 insertions, 11 deletions
diff --git a/include/api.php b/include/api.php index ffdcdfdd6..6cd3318ef 100644 --- a/include/api.php +++ b/include/api.php @@ -243,6 +243,13 @@ } 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 @@ -280,9 +287,16 @@ ); $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( @@ -290,21 +304,21 @@ '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', @@ -316,8 +330,8 @@ '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 ); diff --git a/view/api_user_xml.tpl b/view/api_user_xml.tpl index 15517fc42..78cc1f530 100644 --- a/view/api_user_xml.tpl +++ b/view/api_user_xml.tpl @@ -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> @@ -21,10 +21,10 @@ <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> |