commit
63b8b5761d
1 changed files with 37 additions and 37 deletions
|
@ -301,6 +301,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger("api_get_user: user ".$user, LOGGER_DEBUG);
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
if (api_user()===false) {
|
if (api_user()===false) {
|
||||||
api_login($a); return False;
|
api_login($a); return False;
|
||||||
|
@ -541,6 +543,7 @@
|
||||||
$ret = $data;
|
$ret = $data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,8 +581,7 @@
|
||||||
unset($user_info["status"]["user"]);
|
unset($user_info["status"]["user"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($user_info["cid"]);
|
|
||||||
unset($user_info["uid"]);
|
unset($user_info["uid"]);
|
||||||
unset($user_info["self"]);
|
unset($user_info["self"]);
|
||||||
|
|
||||||
|
@ -724,6 +726,9 @@
|
||||||
|
|
||||||
function api_status_show(&$a, $type){
|
function api_status_show(&$a, $type){
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
|
|
||||||
|
logger('api_status_show: user_info: '.print_r($user_info, true), LOGGER_DEBUG);
|
||||||
|
|
||||||
// get last public wall message
|
// get last public wall message
|
||||||
$lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `c`.`nick` as `reply_author`, `i`.`author-link` AS `item-author`
|
$lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `c`.`nick` as `reply_author`, `i`.`author-link` AS `item-author`
|
||||||
FROM `item`, `contact`, `item` as `i`, `contact` as `c`
|
FROM `item`, `contact`, `item` as `i`, `contact` as `c`
|
||||||
|
@ -758,6 +763,7 @@
|
||||||
$in_reply_to_user_id = $r[0]['id'];
|
$in_reply_to_user_id = $r[0]['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_info = array(
|
$status_info = array(
|
||||||
'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
|
'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
|
@ -780,8 +786,7 @@
|
||||||
elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network']) != $status_info["source"]))
|
elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network']) != $status_info["source"]))
|
||||||
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network']).')');
|
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network']).')');
|
||||||
|
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($status_info["user"]["cid"]);
|
|
||||||
unset($status_info["user"]["uid"]);
|
unset($status_info["user"]["uid"]);
|
||||||
unset($status_info["user"]["self"]);
|
unset($status_info["user"]["self"]);
|
||||||
}
|
}
|
||||||
|
@ -862,8 +867,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($user_info["cid"]);
|
|
||||||
unset($user_info["uid"]);
|
unset($user_info["uid"]);
|
||||||
unset($user_info["self"]);
|
unset($user_info["self"]);
|
||||||
|
|
||||||
|
@ -1091,9 +1095,11 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function api_statuses_repeat(&$a, $type){
|
function api_statuses_repeat(&$a, $type){
|
||||||
|
global $called_api;
|
||||||
|
|
||||||
if (api_user()===false) return false;
|
if (api_user()===false) return false;
|
||||||
|
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
|
@ -1123,13 +1129,17 @@
|
||||||
|
|
||||||
if ($r[0]['body'] != "") {
|
if ($r[0]['body'] != "") {
|
||||||
if (!intval(get_config('system','old_share'))) {
|
if (!intval(get_config('system','old_share'))) {
|
||||||
$post = "[share author='".str_replace("'", "'", $r[0]['reply_author']).
|
if (strpos($r[0]['body'], "[/share]") !== false) {
|
||||||
"' profile='".$r[0]['reply_url'].
|
$pos = strpos($r[0]['body'], "[share");
|
||||||
"' avatar='".$r[0]['reply_photo'].
|
$post = substr($r[0]['body'], $pos);
|
||||||
"' link='".$r[0]['plink']."']";
|
} else {
|
||||||
|
$post = "[share author='".str_replace("'", "'", $r[0]['author-name']).
|
||||||
$post .= $r[0]['body'];
|
"' profile='".$r[0]['author-link'].
|
||||||
$post .= "[/share]";
|
"' avatar='".$r[0]['author-avatar'].
|
||||||
|
"' link='".$r[0]['plink']."']";
|
||||||
|
$post .= $r[0]['body'];
|
||||||
|
$post .= "[/share]";
|
||||||
|
}
|
||||||
$_REQUEST['body'] = $post;
|
$_REQUEST['body'] = $post;
|
||||||
} else
|
} else
|
||||||
$_REQUEST['body'] = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')."[url=".$r[0]['reply_url']."]".$r[0]['reply_author']."[/url] \n".$r[0]['body'];
|
$_REQUEST['body'] = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')."[url=".$r[0]['reply_url']."]".$r[0]['reply_author']."[/url] \n".$r[0]['body'];
|
||||||
|
@ -1142,17 +1152,14 @@
|
||||||
item_post($a);
|
item_post($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'xml')
|
// this should output the last post (the one we just posted).
|
||||||
$ok = "true";
|
$called_api = null;
|
||||||
else
|
return(api_status_show($a,$type));
|
||||||
$ok = "ok";
|
|
||||||
|
|
||||||
return api_apply_template('test', $type, array('$ok' => $ok));
|
|
||||||
}
|
}
|
||||||
api_register_func('api/statuses/retweet','api_statuses_repeat', true);
|
api_register_func('api/statuses/retweet','api_statuses_repeat', true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function api_statuses_destroy(&$a, $type){
|
function api_statuses_destroy(&$a, $type){
|
||||||
if (api_user()===false) return false;
|
if (api_user()===false) return false;
|
||||||
|
@ -1167,15 +1174,12 @@
|
||||||
|
|
||||||
logger('API: api_statuses_destroy: '.$id);
|
logger('API: api_statuses_destroy: '.$id);
|
||||||
|
|
||||||
|
$ret = api_statuses_show($a, $type);
|
||||||
|
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
drop_item($id, false);
|
drop_item($id, false);
|
||||||
|
|
||||||
if ($type == 'xml')
|
return($ret);
|
||||||
$ok = "true";
|
|
||||||
else
|
|
||||||
$ok = "ok";
|
|
||||||
|
|
||||||
return api_apply_template('test', $type, array('$ok' => $ok));
|
|
||||||
}
|
}
|
||||||
api_register_func('api/statuses/destroy','api_statuses_destroy', true);
|
api_register_func('api/statuses/destroy','api_statuses_destroy', true);
|
||||||
|
|
||||||
|
@ -1474,11 +1478,9 @@
|
||||||
'recipient' => $recipient,
|
'recipient' => $recipient,
|
||||||
);
|
);
|
||||||
|
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($ret["sender"]["cid"]);
|
|
||||||
unset($ret["sender"]["uid"]);
|
unset($ret["sender"]["uid"]);
|
||||||
unset($ret["sender"]["self"]);
|
unset($ret["sender"]["self"]);
|
||||||
unset($ret["recipient"]["cid"]);
|
|
||||||
unset($ret["recipient"]["uid"]);
|
unset($ret["recipient"]["uid"]);
|
||||||
unset($ret["recipient"]["self"]);
|
unset($ret["recipient"]["self"]);
|
||||||
|
|
||||||
|
@ -1595,8 +1597,7 @@
|
||||||
$status["retweeted_status"] = $retweeted_status;
|
$status["retweeted_status"] = $retweeted_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($status["user"]["cid"]);
|
|
||||||
unset($status["user"]["uid"]);
|
unset($status["user"]["uid"]);
|
||||||
unset($status["user"]["self"]);
|
unset($status["user"]["self"]);
|
||||||
|
|
||||||
|
@ -1655,15 +1656,15 @@
|
||||||
else
|
else
|
||||||
$ok = "ok";
|
$ok = "ok";
|
||||||
|
|
||||||
return api_apply_template('test', $type, array('$ok' => $ok));
|
return api_apply_template('test', $type, array("$ok" => $ok));
|
||||||
|
|
||||||
}
|
}
|
||||||
api_register_func('api/help/test','api_help_test',false);
|
api_register_func('api/help/test','api_help_test',false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://dev.twitter.com/docs/api/1/get/statuses/friends
|
* https://dev.twitter.com/docs/api/1/get/statuses/friends
|
||||||
* This function is deprecated by Twitter
|
* This function is deprecated by Twitter
|
||||||
* returns: json, xml
|
* returns: json, xml
|
||||||
**/
|
**/
|
||||||
function api_statuses_f(&$a, $type, $qtype) {
|
function api_statuses_f(&$a, $type, $qtype) {
|
||||||
if (api_user()===false) return false;
|
if (api_user()===false) return false;
|
||||||
|
@ -1696,8 +1697,7 @@
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach($r as $cid){
|
foreach($r as $cid){
|
||||||
$user = api_get_user($a, $cid['nurl']);
|
$user = api_get_user($a, $cid['nurl']);
|
||||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
unset($user["cid"]);
|
|
||||||
unset($user["uid"]);
|
unset($user["uid"]);
|
||||||
unset($user["self"]);
|
unset($user["self"]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue