Merge pull request #896 from annando/master
API and Diaspora posting connector
This commit is contained in:
commit
310cc0cedb
6 changed files with 156 additions and 33 deletions
4
boot.php
4
boot.php
|
@ -141,6 +141,7 @@ define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace
|
||||||
define ( 'NETWORK_GPLUS', 'goog'); // Google+
|
define ( 'NETWORK_GPLUS', 'goog'); // Google+
|
||||||
define ( 'NETWORK_PUMPIO', 'pump'); // pump.io
|
define ( 'NETWORK_PUMPIO', 'pump'); // pump.io
|
||||||
define ( 'NETWORK_TWITTER', 'twit'); // Twitter
|
define ( 'NETWORK_TWITTER', 'twit'); // Twitter
|
||||||
|
define ( 'NETWORK_DIASPORA2', 'dspc'); // Diaspora connector
|
||||||
|
|
||||||
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
|
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
|
||||||
|
|
||||||
|
@ -165,6 +166,7 @@ $netgroup_ids = array(
|
||||||
NETWORK_GPLUS => (-12),
|
NETWORK_GPLUS => (-12),
|
||||||
NETWORK_PUMPIO => (-13),
|
NETWORK_PUMPIO => (-13),
|
||||||
NETWORK_TWITTER => (-14),
|
NETWORK_TWITTER => (-14),
|
||||||
|
NETWORK_DIASPORA2 => (-15),
|
||||||
|
|
||||||
NETWORK_PHANTOM => (-127),
|
NETWORK_PHANTOM => (-127),
|
||||||
);
|
);
|
||||||
|
@ -1628,7 +1630,7 @@ if(! function_exists('get_birthdays')) {
|
||||||
$sparkle = " sparkle";
|
$sparkle = " sparkle";
|
||||||
$url = $a->get_baseurl() . '/redir/' . $rr['cid'];
|
$url = $a->get_baseurl() . '/redir/' . $rr['cid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rr['link'] = $url;
|
$rr['link'] = $url;
|
||||||
$rr['title'] = $rr['name'];
|
$rr['title'] = $rr['name'];
|
||||||
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
|
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : '');
|
||||||
|
|
|
@ -320,7 +320,7 @@ function populate_acl($user = null,$celeb = false) {
|
||||||
$o .= '</div>';
|
$o .= '</div>';
|
||||||
$o .= '</div>' . "\r\n";
|
$o .= '</div>' . "\r\n";
|
||||||
$o .= '<div id="acl-wrapper-end"></div>' . "\r\n";*/
|
$o .= '<div id="acl-wrapper-end"></div>' . "\r\n";*/
|
||||||
|
|
||||||
$tpl = get_markup_template("acl_selector.tpl");
|
$tpl = get_markup_template("acl_selector.tpl");
|
||||||
$o = replace_macros($tpl, array(
|
$o = replace_macros($tpl, array(
|
||||||
'$showall'=> t("Visible to everybody"),
|
'$showall'=> t("Visible to everybody"),
|
||||||
|
@ -334,8 +334,8 @@ function populate_acl($user = null,$celeb = false) {
|
||||||
"aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false")
|
"aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false")
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
172
include/api.php
172
include/api.php
|
@ -34,8 +34,11 @@
|
||||||
|
|
||||||
function api_register_func($path, $func, $auth=false){
|
function api_register_func($path, $func, $auth=false){
|
||||||
global $API;
|
global $API;
|
||||||
$API[$path] = array('func'=>$func,
|
$API[$path] = array('func'=>$func, 'auth'=>$auth);
|
||||||
'auth'=>$auth);
|
|
||||||
|
// Workaround for hotot
|
||||||
|
$path = str_replace("api/", "api/1.1/", $path);
|
||||||
|
$API[$path] = array('func'=>$func, 'auth'=>$auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,6 +343,7 @@
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
'id' => $r[0]["id"],
|
'id' => $r[0]["id"],
|
||||||
|
'id_str' => (string) $r[0]["id"],
|
||||||
'name' => $r[0]["name"],
|
'name' => $r[0]["name"],
|
||||||
'screen_name' => (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']),
|
'screen_name' => (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']),
|
||||||
'location' => NULL,
|
'location' => NULL,
|
||||||
|
@ -381,7 +385,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// count public wall messages
|
// count public wall messages
|
||||||
$r = q("SELECT COUNT(`id`) as `count` FROM `item` USE INDEX (uid, type)
|
$r = q("SELECT COUNT(`id`) as `count` FROM `item`
|
||||||
WHERE `uid` = %d
|
WHERE `uid` = %d
|
||||||
AND `type`='wall'
|
AND `type`='wall'
|
||||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
|
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
|
||||||
|
@ -448,11 +452,15 @@
|
||||||
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
|
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($uinfo[0]['url'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once('include/contact_selectors.php');
|
||||||
|
$network_name = network_to_name($uinfo[0]['network']);
|
||||||
|
|
||||||
$ret = Array(
|
$ret = Array(
|
||||||
'id' => intval($r[0]['id']),
|
'id' => intval($r[0]['id']),
|
||||||
|
'id_str' => (string) intval($r[0]['id']),
|
||||||
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
|
'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']),
|
||||||
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
|
'screen_name' => (($uinfo[0]['nick']) ? $uinfo[0]['nick'] : $uinfo[0]['name']),
|
||||||
'location' => ($usr) ? $usr[0]['default-location'] : NULL,
|
'location' => ($usr) ? $usr[0]['default-location'] : $network_name,
|
||||||
'description' => (($profile) ? $profile[0]['pdesc'] : NULL),
|
'description' => (($profile) ? $profile[0]['pdesc'] : NULL),
|
||||||
'profile_image_url' => $uinfo[0]['micro'],
|
'profile_image_url' => $uinfo[0]['micro'],
|
||||||
'profile_image_url_https' => $uinfo[0]['micro'],
|
'profile_image_url_https' => $uinfo[0]['micro'],
|
||||||
|
@ -460,13 +468,13 @@
|
||||||
'protected' => false,
|
'protected' => false,
|
||||||
'followers_count' => intval($countfollowers),
|
'followers_count' => intval($countfollowers),
|
||||||
'friends_count' => intval($countfriends),
|
'friends_count' => intval($countfriends),
|
||||||
'created_at' => api_date($uinfo[0]['name-date']),
|
'created_at' => api_date($uinfo[0]['created']),
|
||||||
'favourites_count' => intval($starred),
|
'favourites_count' => intval($starred),
|
||||||
'utc_offset' => "0", // To-Do
|
'utc_offset' => "0",
|
||||||
'time_zone' => 'UTC', // To-Do $uinfo[0]['timezone'],
|
'time_zone' => 'UTC',
|
||||||
'statuses_count' => intval($countitms),
|
'statuses_count' => intval($countitms),
|
||||||
'following' => true, //#XXX: fix me
|
'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) OR ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
|
||||||
'verified' => true, //#XXX: fix me
|
'verified' => true,
|
||||||
'statusnet_blocking' => false,
|
'statusnet_blocking' => false,
|
||||||
'notifications' => false,
|
'notifications' => false,
|
||||||
'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
|
'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
|
||||||
|
@ -513,9 +521,16 @@
|
||||||
// Comments in threads may appear as wall-to-wall postings.
|
// Comments in threads may appear as wall-to-wall postings.
|
||||||
// So only take the owner at the top posting.
|
// So only take the owner at the top posting.
|
||||||
if ($item["id"] == $item["parent"])
|
if ($item["id"] == $item["parent"])
|
||||||
return api_get_user($a,$item["owner-link"]);
|
$status_user = api_get_user($a,$item["owner-link"]);
|
||||||
else
|
else
|
||||||
return api_get_user($a,$item["author-link"]);
|
$status_user = api_get_user($a,$item["author-link"]);
|
||||||
|
|
||||||
|
$status_user["protected"] = (($item["allow_cid"] != "") OR
|
||||||
|
($item["allow_gid"] != "") OR
|
||||||
|
($item["deny_cid"] != "") OR
|
||||||
|
($item["deny_gid"] != ""));
|
||||||
|
|
||||||
|
return ($status_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -732,7 +747,8 @@
|
||||||
// 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`
|
||||||
WHERE `item`.`contact-id` = %d AND `item`.`owner-link` = '%s'
|
WHERE `item`.`contact-id` = %d
|
||||||
|
AND ((`item`.`author-link` IN ('%s', '%s')) OR (`item`.`owner-link` IN ('%s', '%s')))
|
||||||
AND `i`.`id` = `item`.`parent`
|
AND `i`.`id` = `item`.`parent`
|
||||||
AND `contact`.`id`=`item`.`contact-id` AND `c`.`id`=`i`.`contact-id` AND `contact`.`self`=1
|
AND `contact`.`id`=`item`.`contact-id` AND `c`.`id`=`i`.`contact-id` AND `contact`.`self`=1
|
||||||
AND `item`.`type`!='activity'
|
AND `item`.`type`!='activity'
|
||||||
|
@ -740,7 +756,10 @@
|
||||||
ORDER BY `item`.`created` DESC
|
ORDER BY `item`.`created` DESC
|
||||||
LIMIT 1",
|
LIMIT 1",
|
||||||
intval($user_info['cid']),
|
intval($user_info['cid']),
|
||||||
dbesc($user_info['url'])
|
dbesc($user_info['url']),
|
||||||
|
dbesc(normalise_link($user_info['url'])),
|
||||||
|
dbesc($user_info['url']),
|
||||||
|
dbesc(normalise_link($user_info['url']))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($lastwall)>0){
|
if (count($lastwall)>0){
|
||||||
|
@ -748,9 +767,12 @@
|
||||||
|
|
||||||
$in_reply_to_status_id = NULL;
|
$in_reply_to_status_id = NULL;
|
||||||
$in_reply_to_user_id = NULL;
|
$in_reply_to_user_id = NULL;
|
||||||
|
$in_reply_to_status_id_str = NULL;
|
||||||
|
$in_reply_to_user_id_str = NULL;
|
||||||
$in_reply_to_screen_name = NULL;
|
$in_reply_to_screen_name = NULL;
|
||||||
if ($lastwall['parent']!=$lastwall['id']) {
|
if ($lastwall['parent']!=$lastwall['id']) {
|
||||||
$in_reply_to_status_id=$lastwall['parent'];
|
$in_reply_to_status_id= intval($lastwall['parent']);
|
||||||
|
$in_reply_to_status_id_str = (string) intval($lastwall['parent']);
|
||||||
//$in_reply_to_user_id = $lastwall['reply_uid'];
|
//$in_reply_to_user_id = $lastwall['reply_uid'];
|
||||||
//$in_reply_to_screen_name = $lastwall['reply_author'];
|
//$in_reply_to_screen_name = $lastwall['reply_author'];
|
||||||
|
|
||||||
|
@ -760,7 +782,8 @@
|
||||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||||
|
|
||||||
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
||||||
$in_reply_to_user_id = $r[0]['id'];
|
$in_reply_to_user_id = intval($r[0]['id']);
|
||||||
|
$in_reply_to_user_id_str = (string) intval($r[0]['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,9 +792,12 @@
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
|
'in_reply_to_status_id_str' => $in_reply_to_status_id_str,
|
||||||
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||||
'id' => $lastwall['id'],
|
'id' => intval($lastwall['id']),
|
||||||
|
'id_str' => (string) $lastwall['id'],
|
||||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||||
|
'in_reply_to_user_id_str' => $in_reply_to_user_id_str,
|
||||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||||
'geo' => NULL,
|
'geo' => NULL,
|
||||||
'favorited' => false,
|
'favorited' => false,
|
||||||
|
@ -812,36 +838,43 @@
|
||||||
|
|
||||||
$lastwall = q("SELECT `item`.*
|
$lastwall = q("SELECT `item`.*
|
||||||
FROM `item`, `contact`
|
FROM `item`, `contact`
|
||||||
WHERE `item`.`contact-id` = %d AND `item`.`owner-link` = '%s'
|
WHERE `item`.`contact-id` = %d
|
||||||
|
AND ((`item`.`author-link` IN ('%s', '%s')) OR (`item`.`owner-link` IN ('%s', '%s')))
|
||||||
AND `contact`.`id`=`item`.`contact-id`
|
AND `contact`.`id`=`item`.`contact-id`
|
||||||
AND `type`!='activity'
|
AND `type`!='activity'
|
||||||
AND `item`.`allow_cid`='' AND `item`.`allow_gid`='' AND `item`.`deny_cid`='' AND `item`.`deny_gid`=''
|
AND `item`.`allow_cid`='' AND `item`.`allow_gid`='' AND `item`.`deny_cid`='' AND `item`.`deny_gid`=''
|
||||||
ORDER BY `created` DESC
|
ORDER BY `created` DESC
|
||||||
LIMIT 1",
|
LIMIT 1",
|
||||||
intval($user_info['cid']),
|
intval($user_info['cid']),
|
||||||
dbesc($user_info['url'])
|
dbesc($user_info['url']),
|
||||||
|
dbesc(normalise_link($user_info['url'])),
|
||||||
|
dbesc($user_info['url']),
|
||||||
|
dbesc(normalise_link($user_info['url']))
|
||||||
);
|
);
|
||||||
|
//print_r($user_info);
|
||||||
if (count($lastwall)>0){
|
if (count($lastwall)>0){
|
||||||
$lastwall = $lastwall[0];
|
$lastwall = $lastwall[0];
|
||||||
|
|
||||||
$in_reply_to_status_id = NULL;
|
$in_reply_to_status_id = NULL;
|
||||||
$in_reply_to_user_id = NULL;
|
$in_reply_to_user_id = NULL;
|
||||||
|
$in_reply_to_status_id_str = NULL;
|
||||||
|
$in_reply_to_user_id_str = NULL;
|
||||||
$in_reply_to_screen_name = NULL;
|
$in_reply_to_screen_name = NULL;
|
||||||
if ($lastwall['parent']!=$lastwall['id']) {
|
if ($lastwall['parent']!=$lastwall['id']) {
|
||||||
$reply = q("SELECT `item`.`id`, `item`.`contact-id` as `reply_uid`, `contact`.`nick` as `reply_author`, `item`.`author-link` AS `item-author`
|
$reply = q("SELECT `item`.`id`, `item`.`contact-id` as `reply_uid`, `contact`.`nick` as `reply_author`, `item`.`author-link` AS `item-author`
|
||||||
FROM `item`,`contact` WHERE `contact`.`id`=`item`.`contact-id` AND `item`.`id` = %d", intval($lastwall['parent']));
|
FROM `item`,`contact` WHERE `contact`.`id`=`item`.`contact-id` AND `item`.`id` = %d", intval($lastwall['parent']));
|
||||||
if (count($reply)>0) {
|
if (count($reply)>0) {
|
||||||
$in_reply_to_status_id=$lastwall['parent'];
|
$in_reply_to_status_id = intval($lastwall['parent']);
|
||||||
//$in_reply_to_user_id = $reply[0]['reply_uid'];
|
$in_reply_to_status_id_str = (string) intval($lastwall['parent']);
|
||||||
//$in_reply_to_screen_name = $reply[0]['reply_author'];
|
|
||||||
$r = q("SELECT * FROM unique_contacts WHERE `url` = '%s'", dbesc(normalise_link($reply[0]['item-author'])));
|
$r = q("SELECT * FROM unique_contacts WHERE `url` = '%s'", dbesc(normalise_link($reply[0]['item-author'])));
|
||||||
if ($r) {
|
if ($r) {
|
||||||
if ($r[0]['nick'] == "")
|
if ($r[0]['nick'] == "")
|
||||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||||
|
|
||||||
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
||||||
$in_reply_to_user_id = $r[0]['id'];
|
$in_reply_to_user_id = intval($r[0]['id']);
|
||||||
|
$in_reply_to_user_id_str = (string) intval($r[0]['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,9 +883,12 @@
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
|
'in_reply_to_status_id_str' => $in_reply_to_status_id_str,
|
||||||
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||||
'id' => $lastwall['contact-id'],
|
'id' => intval($lastwall['contact-id']),
|
||||||
|
'id_str' => (string) $lastwall['contact-id'],
|
||||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||||
|
'in_reply_to_user_id_str' => $in_reply_to_user_id_str,
|
||||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||||
'geo' => NULL,
|
'geo' => NULL,
|
||||||
'favorited' => false,
|
'favorited' => false,
|
||||||
|
@ -1050,6 +1086,10 @@
|
||||||
if ($id == 0)
|
if ($id == 0)
|
||||||
$id = intval($_REQUEST["id"]);
|
$id = intval($_REQUEST["id"]);
|
||||||
|
|
||||||
|
// Hotot workaround
|
||||||
|
if ($id == 0)
|
||||||
|
$id = intval($a->argv[4]);
|
||||||
|
|
||||||
logger('API: api_statuses_show: '.$id);
|
logger('API: api_statuses_show: '.$id);
|
||||||
|
|
||||||
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
||||||
|
@ -1094,6 +1134,67 @@
|
||||||
api_register_func('api/statuses/show','api_statuses_show', true);
|
api_register_func('api/statuses/show','api_statuses_show', true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function api_conversation_show(&$a, $type){
|
||||||
|
if (api_user()===false) return false;
|
||||||
|
|
||||||
|
$user_info = api_get_user($a);
|
||||||
|
|
||||||
|
// params
|
||||||
|
$id = intval($a->argv[3]);
|
||||||
|
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
|
||||||
|
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||||
|
if ($page<0) $page=0;
|
||||||
|
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||||
|
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
|
||||||
|
|
||||||
|
$start = $page*$count;
|
||||||
|
|
||||||
|
if ($id == 0)
|
||||||
|
$id = intval($_REQUEST["id"]);
|
||||||
|
|
||||||
|
// Hotot workaround
|
||||||
|
if ($id == 0)
|
||||||
|
$id = intval($a->argv[4]);
|
||||||
|
|
||||||
|
logger('API: api_conversation_show: '.$id);
|
||||||
|
|
||||||
|
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
||||||
|
|
||||||
|
$sql_extra = '';
|
||||||
|
|
||||||
|
if ($max_id > 0)
|
||||||
|
$sql_extra = ' AND `item`.`id` <= '.intval($max_id);
|
||||||
|
|
||||||
|
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||||
|
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||||
|
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||||
|
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||||
|
FROM `item` INNER JOIN (SELECT `uri`,`parent` FROM `item` WHERE `id` = %d) AS `temp1`
|
||||||
|
ON (`item`.`thr-parent` = `temp1`.`uri` AND `item`.`parent` = `temp1`.`parent`), `contact`
|
||||||
|
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||||
|
AND `item`.`uid` = %d AND `contact`.`id` = `item`.`contact-id`
|
||||||
|
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||||
|
AND `item`.`id`>%d $sql_extra
|
||||||
|
ORDER BY `item`.`received` DESC LIMIT %d ,%d",
|
||||||
|
intval($id), intval(api_user()),
|
||||||
|
intval($since_id),
|
||||||
|
intval($start), intval($count)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$r)
|
||||||
|
die(api_error($a, $type, t("There is no conversation with this id.")));
|
||||||
|
|
||||||
|
$ret = api_format_items($r,$user_info);
|
||||||
|
|
||||||
|
$data = array('$statuses' => $ret);
|
||||||
|
return api_apply_template("timeline", $type, $data);
|
||||||
|
}
|
||||||
|
api_register_func('api/conversation/show','api_conversation_show', true);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -1110,6 +1211,10 @@
|
||||||
if ($id == 0)
|
if ($id == 0)
|
||||||
$id = intval($_REQUEST["id"]);
|
$id = intval($_REQUEST["id"]);
|
||||||
|
|
||||||
|
// Hotot workaround
|
||||||
|
if ($id == 0)
|
||||||
|
$id = intval($a->argv[4]);
|
||||||
|
|
||||||
logger('API: api_statuses_repeat: '.$id);
|
logger('API: api_statuses_repeat: '.$id);
|
||||||
|
|
||||||
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
||||||
|
@ -1172,6 +1277,10 @@
|
||||||
if ($id == 0)
|
if ($id == 0)
|
||||||
$id = intval($_REQUEST["id"]);
|
$id = intval($_REQUEST["id"]);
|
||||||
|
|
||||||
|
// Hotot workaround
|
||||||
|
if ($id == 0)
|
||||||
|
$id = intval($a->argv[4]);
|
||||||
|
|
||||||
logger('API: api_statuses_destroy: '.$id);
|
logger('API: api_statuses_destroy: '.$id);
|
||||||
|
|
||||||
$ret = api_statuses_show($a, $type);
|
$ret = api_statuses_show($a, $type);
|
||||||
|
@ -1526,12 +1635,15 @@
|
||||||
intval(api_user()),
|
intval(api_user()),
|
||||||
dbesc($item['thr-parent']));
|
dbesc($item['thr-parent']));
|
||||||
if ($r)
|
if ($r)
|
||||||
$in_reply_to_status_id = $r[0]['id'];
|
$in_reply_to_status_id = intval($r[0]['id']);
|
||||||
else
|
else
|
||||||
$in_reply_to_status_id = $item['parent'];
|
$in_reply_to_status_id = intval($item['parent']);
|
||||||
|
|
||||||
|
$in_reply_to_status_id_str = (string) intval($item['parent']);
|
||||||
|
|
||||||
$in_reply_to_screen_name = NULL;
|
$in_reply_to_screen_name = NULL;
|
||||||
$in_reply_to_user_id = NULL;
|
$in_reply_to_user_id = NULL;
|
||||||
|
$in_reply_to_user_id_str = NULL;
|
||||||
|
|
||||||
$r = q("SELECT `author-link` FROM item WHERE uid=%d AND id=%d LIMIT 1",
|
$r = q("SELECT `author-link` FROM item WHERE uid=%d AND id=%d LIMIT 1",
|
||||||
intval(api_user()),
|
intval(api_user()),
|
||||||
|
@ -1544,13 +1656,16 @@
|
||||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||||
|
|
||||||
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
$in_reply_to_screen_name = (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']);
|
||||||
$in_reply_to_user_id = $r[0]['id'];
|
$in_reply_to_user_id = intval($r[0]['id']);
|
||||||
|
$in_reply_to_user_id_str = (string) intval($r[0]['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$in_reply_to_screen_name = NULL;
|
$in_reply_to_screen_name = NULL;
|
||||||
$in_reply_to_user_id = NULL;
|
$in_reply_to_user_id = NULL;
|
||||||
$in_reply_to_status_id = NULL;
|
$in_reply_to_status_id = NULL;
|
||||||
|
$in_reply_to_user_id_str = NULL;
|
||||||
|
$in_reply_to_status_id_str = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for ostatus messages where the title is identically to the body
|
// Workaround for ostatus messages where the title is identically to the body
|
||||||
|
@ -1571,9 +1686,12 @@
|
||||||
'truncated' => False,
|
'truncated' => False,
|
||||||
'created_at'=> api_date($item['created']),
|
'created_at'=> api_date($item['created']),
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
|
'in_reply_to_status_id_str' => $in_reply_to_status_id,
|
||||||
'source' => (($item['app']) ? $item['app'] : 'web'),
|
'source' => (($item['app']) ? $item['app'] : 'web'),
|
||||||
'id' => intval($item['id']),
|
'id' => intval($item['id']),
|
||||||
|
'id_str' => (string) intval($item['id']),
|
||||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||||
|
'in_reply_to_user_id_str' => $in_reply_to_user_id,
|
||||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||||
'geo' => NULL,
|
'geo' => NULL,
|
||||||
'favorited' => $item['starred'] ? true : false,
|
'favorited' => $item['starred'] ? true : false,
|
||||||
|
|
|
@ -99,7 +99,7 @@ class dba {
|
||||||
if (($duration > $a->config["system"]["db_loglimit"])) {
|
if (($duration > $a->config["system"]["db_loglimit"])) {
|
||||||
$duration = round($duration, 3);
|
$duration = round($duration, 3);
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
@file_put_contents($a->config["system"]["db_log"], $duration."\t".
|
@file_put_contents($a->config["system"]["db_log"], datetime_convert()."\t".$duration."\t".
|
||||||
basename($backtrace[1]["file"])."\t".
|
basename($backtrace[1]["file"])."\t".
|
||||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||||
substr($sql, 0, 2000)."\n", FILE_APPEND);
|
substr($sql, 0, 2000)."\n", FILE_APPEND);
|
||||||
|
|
|
@ -218,7 +218,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
||||||
|
|
||||||
$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
|
$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
if (!$compact) {
|
if (!$compact AND ($message != "")) {
|
||||||
$counter = 1;
|
$counter = 1;
|
||||||
foreach ($urls as $id=>$url)
|
foreach ($urls as $id=>$url)
|
||||||
if (strpos($message, $url) === false)
|
if (strpos($message, $url) === false)
|
||||||
|
|
|
@ -89,6 +89,9 @@ function poller_run(&$argv, &$argc){
|
||||||
// Check OStatus conversations
|
// Check OStatus conversations
|
||||||
check_conversations();
|
check_conversations();
|
||||||
|
|
||||||
|
// To-Do: Regenerate usage statistics
|
||||||
|
// q("ANALYZE TABLE `item`");
|
||||||
|
|
||||||
// once daily run birthday_updates and then expire in background
|
// once daily run birthday_updates and then expire in background
|
||||||
|
|
||||||
$d1 = get_config('system','last_expire_day');
|
$d1 = get_config('system','last_expire_day');
|
||||||
|
|
Loading…
Reference in a new issue