aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-31 20:01:00 -0700
committerFriendika <info@friendika.com>2011-07-31 20:01:00 -0700
commit996425206f86967a50923cf61e18776749a49e52 (patch)
treea4bf2fe712185d98e2622b22a88482f6b0e25a84 /include/api.php
parentb0a9ec0a73183e48158a4e42db49943c56db9098 (diff)
downloadvolse-hubzilla-996425206f86967a50923cf61e18776749a49e52.tar.gz
volse-hubzilla-996425206f86967a50923cf61e18776749a49e52.tar.bz2
volse-hubzilla-996425206f86967a50923cf61e18776749a49e52.zip
api profiles
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php59
1 files changed, 48 insertions, 11 deletions
diff --git a/include/api.php b/include/api.php
index 0d446d1a7..45ca6f1a8 100644
--- a/include/api.php
+++ b/include/api.php
@@ -147,7 +147,26 @@
//echo "<pre>"; var_dump($r); die();
}
}
- return false;
+ $r = '<status><error>not implemented</error></status>';
+ switch($type){
+ case "xml":
+ header ("Content-Type: text/xml");
+ return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
+ break;
+ case "json":
+ header ("Content-Type: application/json");
+ return json_encode(array('error' => 'not implemented'));
+ break;
+ case "rss":
+ header ("Content-Type: application/rss+xml");
+ return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
+ break;
+ case "atom":
+ header ("Content-Type: application/atom+xml");
+ return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
+ break;
+
+ }
}
/**
@@ -222,15 +241,25 @@
return False;
}
- // count public wall messages
- $r = q("SELECT COUNT(`id`) as `count` FROM `item`
- WHERE `uid` = %d
- AND `type`='wall'
- AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
- intval($uinfo[0]['uid'])
- );
- $countitms = $r[0]['count'];
-
+ if($uinfo[0]['self']) {
+ // count public wall messages
+ $r = q("SELECT COUNT(`id`) as `count` FROM `item`
+ WHERE `uid` = %d
+ AND `type`='wall'
+ AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
+ intval($uinfo[0]['uid'])
+ );
+ $countitms = $r[0]['count'];
+ }
+ else {
+ $r = q("SELECT COUNT(`id`) as `count` FROM `item`
+ WHERE `contact-id` = %d
+ AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
+ intval($uinfo[0]['id'])
+ );
+ $countitms = $r[0]['count'];
+ }
+
// count friends
$r = q("SELECT COUNT(`id`) as `count` FROM `contact`
WHERE `uid` = %d
@@ -238,7 +267,10 @@
intval($uinfo[0]['uid'])
);
$countfriends = $r[0]['count'];
-
+
+ if(! $uinfo[0]['self']) {
+ $countfriends = 0;
+ }
$ret = Array(
'uid' => $uinfo[0]['uid'],
@@ -664,6 +696,11 @@
function api_format_items($r,$user_info) {
+
+ //logger('api_format_items: ' . print_r($r,true));
+
+ //logger('api_format_items: ' . print_r($user_info,true));
+
$a = get_app();
$ret = Array();