aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/api.php120
1 files changed, 11 insertions, 109 deletions
diff --git a/include/api.php b/include/api.php
index 0c5839143..c0e80d386 100644
--- a/include/api.php
+++ b/include/api.php
@@ -985,19 +985,7 @@ require_once('include/api_zot.php');
$ret = api_format_items($r,$user_info);
- $data = array('$statuses' => $ret);
- switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra( $data, $user_info);
- break;
- case "as":
- $as = api_format_as( $ret, $user_info);
- $as['title'] = App::$config['sitename']. " " . t('Public Timeline');
- $as['link']['url'] = z_root()."/";
- return($as);
- break;
- }
+ $data = array('statuses' => $ret);
return api_apply_template("timeline", $type, $data);
}
@@ -1039,15 +1027,10 @@ require_once('include/api_zot.php');
if ($conversation) {
- $data = array('$statuses' => $ret);
+ $data = array('statuses' => $ret);
return api_apply_template("timeline", $type, $data);
} else {
- $data = array('$status' => $ret[0]);
- /*switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra( $data, $user_info);
- }*/
+ $data = array('status' => $ret[0]);
return api_apply_template("status", $type, $data);
}
}
@@ -1213,19 +1196,7 @@ require_once('include/api_zot.php');
$ret = api_format_items($r,$user_info);
- $data = array('$statuses' => $ret);
- switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra( $data, $user_info);
- break;
- case "as":
- $as = api_format_as( $ret, $user_info);
- $as["title"] = App::$config['sitename']." Mentions";
- $as['link']['url'] = z_root()."/";
- return($as);
- break;
- }
+ $data = array('statuses' => $ret);
return api_apply_template("timeline", $type, $data);
}
@@ -1235,11 +1206,12 @@ require_once('include/api_zot.php');
function api_statuses_user_timeline( $type){
- if (api_user()===false) return false;
+ if(api_user()===false)
+ return false;
$user_info = api_get_user();
- // get last network messages
+ // get last network messages
logger("api_statuses_user_timeline: api_user: ". api_user() .
"\nuser_info: ".print_r($user_info, true) .
@@ -1298,13 +1270,7 @@ require_once('include/api_zot.php');
$ret = api_format_items($r,$user_info);
- $data = array('$statuses' => $ret);
- switch($type){
- case "atom":
- case "rss":
- $data = api_rss_extra( $data, $user_info);
- }
-
+ $data = array('statuses' => $ret);
return api_apply_template("timeline", $type, $data);
}
@@ -1435,71 +1401,6 @@ require_once('include/api_zot.php');
api_register_func('api/favorites','api_favorites', true);
- function api_format_as( $ret, $user_info) {
-
- $as = array();
- $as['title'] = App::$config['sitename']." Public Timeline";
- $items = array();
- foreach ($ret as $item) {
- $singleitem["actor"]["displayName"] = $item["user"]["name"];
- $singleitem["actor"]["id"] = $item["user"]["contact_url"];
- $avatar[0]["url"] = $item["user"]["profile_image_url"];
- $avatar[0]["rel"] = "avatar";
- $avatar[0]["type"] = "";
- $avatar[0]["width"] = 96;
- $avatar[0]["height"] = 96;
- $avatar[1]["url"] = $item["user"]["profile_image_url"];
- $avatar[1]["rel"] = "avatar";
- $avatar[1]["type"] = "";
- $avatar[1]["width"] = 48;
- $avatar[1]["height"] = 48;
- $avatar[2]["url"] = $item["user"]["profile_image_url"];
- $avatar[2]["rel"] = "avatar";
- $avatar[2]["type"] = "";
- $avatar[2]["width"] = 24;
- $avatar[2]["height"] = 24;
- $singleitem["actor"]["avatarLinks"] = $avatar;
-
- $singleitem["actor"]["image"]["url"] = $item["user"]["profile_image_url"];
- $singleitem["actor"]["image"]["rel"] = "avatar";
- $singleitem["actor"]["image"]["type"] = "";
- $singleitem["actor"]["image"]["width"] = 96;
- $singleitem["actor"]["image"]["height"] = 96;
- $singleitem["actor"]["type"] = "person";
- $singleitem["actor"]["url"] = $item["person"]["contact_url"];
- $singleitem["actor"]["statusnet:profile_info"]["local_id"] = $item["user"]["id"];
- $singleitem["actor"]["statusnet:profile_info"]["following"] = $item["user"]["following"] ? "true" : "false";
- $singleitem["actor"]["statusnet:profile_info"]["blocking"] = "false";
- $singleitem["actor"]["contact"]["preferredUsername"] = $item["user"]["screen_name"];
- $singleitem["actor"]["contact"]["displayName"] = $item["user"]["name"];
- $singleitem["actor"]["contact"]["addresses"] = "";
-
- $singleitem["body"] = $item["text"];
- $singleitem["object"]["displayName"] = $item["text"];
- $singleitem["object"]["id"] = $item["url"];
- $singleitem["object"]["type"] = "note";
- $singleitem["object"]["url"] = $item["url"];
- //$singleitem["context"] =;
- $singleitem["postedTime"] = date("c", strtotime($item["published"]));
- $singleitem["provider"]["objectType"] = "service";
- $singleitem["provider"]["displayName"] = "Test";
- $singleitem["provider"]["url"] = "http://test.tld";
- $singleitem["title"] = $item["text"];
- $singleitem["verb"] = "post";
- $singleitem["statusnet:notice_info"]["local_id"] = $item["id"];
- $singleitem["statusnet:notice_info"]["source"] = $item["source"];
- $singleitem["statusnet:notice_info"]["favorite"] = "false";
- $singleitem["statusnet:notice_info"]["repeated"] = "false";
- //$singleitem["original"] = $item;
- $items[] = $singleitem;
- }
- $as['items'] = $items;
- $as['link']['url'] = z_root()."/".$user_info["screen_name"]."/all";
- $as['link']['rel'] = "alternate";
- $as['link']['type'] = "text/html";
- return($as);
- }
-
function api_format_message($item, $recipient, $sender) {
// standard meta information
$ret = array(
@@ -1666,7 +1567,8 @@ require_once('include/api_zot.php');
* returns: json, xml
**/
function api_statuses_f( $type, $qtype) {
- if (api_user()===false) return false;
+ if(api_user()===false)
+ return false;
$user_info = api_get_user();
@@ -1682,7 +1584,7 @@ require_once('include/api_zot.php');
*/
/*$ret=Array();
- return array('$users' => $ret);*/
+ return array('users' => $ret);*/
return false;
}