1
1
Fork 0

more api tweaks

This commit is contained in:
Friendika 2011-08-05 05:17:18 -07:00
parent 6eec04b09c
commit 112fc59e31
2 changed files with 25 additions and 11 deletions

View file

@ -243,6 +243,13 @@
} }
if($uinfo[0]['self']) { 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 // count public wall messages
$r = q("SELECT COUNT(`id`) as `count` FROM `item` $r = q("SELECT COUNT(`id`) as `count` FROM `item`
WHERE `uid` = %d WHERE `uid` = %d
@ -280,9 +287,16 @@
); );
$countfollowers = $r[0]['count']; $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']) { if(! $uinfo[0]['self']) {
$countfriends = 0; $countfriends = 0;
$countfollowers = 0; $countfollowers = 0;
$starred = 0;
} }
$ret = Array( $ret = Array(
@ -290,21 +304,21 @@
'id' => intval($uinfo[0]['cid']), 'id' => intval($uinfo[0]['cid']),
'name' => $uinfo[0]['name'], 'name' => $uinfo[0]['name'],
'screen_name' => $uinfo[0]['nick'], 'screen_name' => $uinfo[0]['nick'],
'location' => '', //$uinfo[0]['default-location'], 'location' => ($usr) ? $usr[0]['default-location'] : '',
'profile_image_url' => $uinfo[0]['micro'], 'profile_image_url' => $uinfo[0]['micro'],
'url' => $uinfo[0]['url'], 'url' => $uinfo[0]['url'],
'contact_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'], 'contact_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
'protected' => false, # 'protected' => false,
'friends_count' => intval($countfriends), 'friends_count' => intval($countfriends),
'created_at' => api_date($uinfo[0]['name-date']), 'created_at' => api_date($uinfo[0]['name-date']),
'utc_offset' => 0, #XXX: fix me 'utc_offset' => "+00:00",
'time_zone' => '', //$uinfo[0]['timezone'], 'time_zone' => 'UTC', //$uinfo[0]['timezone'],
'geo_enabled' => false, 'geo_enabled' => false,
'statuses_count' => intval($countitms), #XXX: fix me 'statuses_count' => intval($countitms), #XXX: fix me
'lang' => 'en', #XXX: fix me 'lang' => 'en', #XXX: fix me
'description' => '', 'description' => (($profile) ? $profile[0]['pdesc'] : ''),
'followers_count' => intval($countfollowers), #XXX: fix me 'followers_count' => intval($countfollowers),
'favourites_count' => 0, 'favourites_count' => intval($starred),
'contributors_enabled' => false, 'contributors_enabled' => false,
'follow_request_sent' => false, 'follow_request_sent' => false,
'profile_background_color' => 'cfe8f6', 'profile_background_color' => 'cfe8f6',
@ -316,8 +330,8 @@
'profile_background_tile' => false, 'profile_background_tile' => false,
'profile_use_background_image' => false, 'profile_use_background_image' => false,
'notifications' => false, 'notifications' => false,
'following' => '', #XXX: fix me
'verified' => true, #XXX: fix me 'verified' => true, #XXX: fix me
'followers' => '', #XXX: fix me
#'status' => null #'status' => null
); );

View file

@ -7,7 +7,7 @@
<profile_image_url>$user.profile_image_url</profile_image_url> <profile_image_url>$user.profile_image_url</profile_image_url>
<url>$user.url</url> <url>$user.url</url>
<protected>$user.protected</protected> <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_background_color>$user.profile_background_color</profile_background_color>
<profile_text_color>$user.profile_text_color</profile_text_color> <profile_text_color>$user.profile_text_color</profile_text_color>
<profile_link_color>$user.profile_link_color</profile_link_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_image_url>$user.profile_background_image_url</profile_background_image_url>
<profile_background_tile>$user.profile_background_tile</profile_background_tile> <profile_background_tile>$user.profile_background_tile</profile_background_tile>
<profile_use_background_image>$user.profile_use_background_image</profile_use_background_image> <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> <geo_enabled>$user.geo_enabled</geo_enabled>
<verified>$user.verified</verified> <verified>$user.verified</verified>
<following></following> <following>$user.following</following>
<statuses_count>$user.statuses_count</statuses_count> <statuses_count>$user.statuses_count</statuses_count>
<lang>$user.lang</lang> <lang>$user.lang</lang>
<contributors_enabled>$user.contributors_enabled</contributors_enabled> <contributors_enabled>$user.contributors_enabled</contributors_enabled>