Removed whitespace
This commit is contained in:
parent
328a6c9e4e
commit
bd1306d020
|
@ -68,7 +68,7 @@ class Seen extends BaseApi
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
// we found the item, return it to the user
|
// we found the item, return it to the user
|
||||||
$ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()];
|
$ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()];
|
||||||
$data = ['status' => $ret];
|
$data = ['status' => $ret];
|
||||||
DI::apiResponse()->exit('statuses', $data, $this->parameters['extension'] ?? null);
|
DI::apiResponse()->exit('statuses', $data, $this->parameters['extension'] ?? null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,39 +39,39 @@ class Favorites extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// in friendica starred item are private
|
// in friendica starred item are private
|
||||||
// return favorites only for self
|
// return favorites only for self
|
||||||
Logger::info(API_LOG_PREFIX . 'for {self}', ['module' => 'api', 'action' => 'favorites']);
|
Logger::info(API_LOG_PREFIX . 'for {self}', ['module' => 'api', 'action' => 'favorites']);
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$since_id = $_REQUEST['since_id'] ?? 0;
|
$since_id = $_REQUEST['since_id'] ?? 0;
|
||||||
$max_id = $_REQUEST['max_id'] ?? 0;
|
$max_id = $_REQUEST['max_id'] ?? 0;
|
||||||
$count = $_GET['count'] ?? 20;
|
$count = $_GET['count'] ?? 20;
|
||||||
$page = $_REQUEST['page'] ?? 1;
|
$page = $_REQUEST['page'] ?? 1;
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `id` > ? AND `starred`",
|
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `id` > ? AND `starred`",
|
||||||
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id];
|
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id];
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ class HomeTimeline extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// get last network messages
|
// get last network messages
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = $_REQUEST['count'] ?? 20;
|
$count = $_REQUEST['count'] ?? 20;
|
||||||
$page = $_REQUEST['page']?? 0;
|
$page = $_REQUEST['page']?? 0;
|
||||||
|
@ -49,12 +49,12 @@ class HomeTimeline extends BaseApi
|
||||||
$max_id = $_REQUEST['max_id'] ?? 0;
|
$max_id = $_REQUEST['max_id'] ?? 0;
|
||||||
$exclude_replies = !empty($_REQUEST['exclude_replies']);
|
$exclude_replies = !empty($_REQUEST['exclude_replies']);
|
||||||
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `id` > ?",
|
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `id` > ?",
|
||||||
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id];
|
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
|
@ -67,12 +67,12 @@ class HomeTimeline extends BaseApi
|
||||||
$condition[0] .= " AND `parent` = ?";
|
$condition[0] .= " AND `parent` = ?";
|
||||||
$condition[] = $conversation_id;
|
$condition[] = $conversation_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
$idarray = [];
|
$idarray = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
|
@ -80,14 +80,14 @@ class HomeTimeline extends BaseApi
|
||||||
$idarray[] = intval($status['id']);
|
$idarray[] = intval($status['id']);
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
if (!empty($idarray)) {
|
if (!empty($idarray)) {
|
||||||
$unseen = Post::exists(['unseen' => true, 'id' => $idarray]);
|
$unseen = Post::exists(['unseen' => true, 'id' => $idarray]);
|
||||||
if ($unseen) {
|
if ($unseen) {
|
||||||
Item::update(['unseen' => false], ['unseen' => true, 'id' => $idarray]);
|
Item::update(['unseen' => false], ['unseen' => true, 'id' => $idarray]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,21 +38,21 @@ class Mentions extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// get last network messages
|
// get last network messages
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$since_id = intval($_REQUEST['since_id'] ?? 0);
|
$since_id = intval($_REQUEST['since_id'] ?? 0);
|
||||||
$max_id = intval($_REQUEST['max_id'] ?? 0);
|
$max_id = intval($_REQUEST['max_id'] ?? 0);
|
||||||
$count = intval($_REQUEST['count'] ?? 20);
|
$count = intval($_REQUEST['count'] ?? 20);
|
||||||
$page = intval($_REQUEST['page'] ?? 1);
|
$page = intval($_REQUEST['page'] ?? 1);
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
$query = "`gravity` IN (?, ?) AND `uri-id` IN
|
$query = "`gravity` IN (?, ?) AND `uri-id` IN
|
||||||
(SELECT `uri-id` FROM `post-user-notification` WHERE `uid` = ? AND `notification-type` & ? != 0 ORDER BY `uri-id`)
|
(SELECT `uri-id` FROM `post-user-notification` WHERE `uid` = ? AND `notification-type` & ? != 0 ORDER BY `uri-id`)
|
||||||
AND (`uid` = 0 OR (`uid` = ? AND NOT `global`)) AND `id` > ?";
|
AND (`uid` = 0 OR (`uid` = ? AND NOT `global`)) AND `id` > ?";
|
||||||
|
|
||||||
$condition = [
|
$condition = [
|
||||||
GRAVITY_PARENT, GRAVITY_COMMENT,
|
GRAVITY_PARENT, GRAVITY_COMMENT,
|
||||||
$uid,
|
$uid,
|
||||||
|
@ -61,25 +61,25 @@ class Mentions extends BaseApi
|
||||||
Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT,
|
Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT,
|
||||||
$uid, $since_id,
|
$uid, $since_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$query .= " AND `id` <= ?";
|
$query .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
array_unshift($condition, $query);
|
array_unshift($condition, $query);
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,35 +37,35 @@ class NetworkPublicTimeline extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
$since_id = $_REQUEST['since_id'] ?? 0;
|
$since_id = $_REQUEST['since_id'] ?? 0;
|
||||||
$max_id = $_REQUEST['max_id'] ?? 0;
|
$max_id = $_REQUEST['max_id'] ?? 0;
|
||||||
|
|
||||||
// pagination
|
// pagination
|
||||||
$count = $_REQUEST['count'] ?? 20;
|
$count = $_REQUEST['count'] ?? 20;
|
||||||
$page = $_REQUEST['page'] ?? 1;
|
$page = $_REQUEST['page'] ?? 1;
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
$condition = ["`uid` = 0 AND `gravity` IN (?, ?) AND `id` > ? AND `private` = ?",
|
$condition = ["`uid` = 0 AND `gravity` IN (?, ?) AND `id` > ? AND `private` = ?",
|
||||||
GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, Item::PUBLIC];
|
GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, Item::PUBLIC];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, Item::DISPLAY_FIELDLIST, $condition, $params);
|
$statuses = Post::selectForUser($uid, Item::DISPLAY_FIELDLIST, $condition, $params);
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ class PublicTimeline extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
// get last network messages
|
// get last network messages
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = $_REQUEST['count'] ?? 20;
|
$count = $_REQUEST['count'] ?? 20;
|
||||||
$page = $_REQUEST['page'] ?? 1;
|
$page = $_REQUEST['page'] ?? 1;
|
||||||
|
@ -47,24 +47,24 @@ class PublicTimeline extends BaseApi
|
||||||
$max_id = $_REQUEST['max_id'] ?? 0;
|
$max_id = $_REQUEST['max_id'] ?? 0;
|
||||||
$exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
|
$exclude_replies = (!empty($_REQUEST['exclude_replies']) ? 1 : 0);
|
||||||
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
if ($exclude_replies && !$conversation_id) {
|
if ($exclude_replies && !$conversation_id) {
|
||||||
$condition = ["`gravity` = ? AND `id` > ? AND `private` = ? AND `wall` AND NOT `author-hidden`",
|
$condition = ["`gravity` = ? AND `id` > ? AND `private` = ? AND `wall` AND NOT `author-hidden`",
|
||||||
GRAVITY_PARENT, $since_id, Item::PUBLIC];
|
GRAVITY_PARENT, $since_id, Item::PUBLIC];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
} else {
|
} else {
|
||||||
$condition = ["`gravity` IN (?, ?) AND `id` > ? AND `private` = ? AND `wall` AND `origin` AND NOT `author-hidden`",
|
$condition = ["`gravity` IN (?, ?) AND `id` > ? AND `private` = ? AND `wall` AND `origin` AND NOT `author-hidden`",
|
||||||
GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, Item::PUBLIC];
|
GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, Item::PUBLIC];
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
|
@ -73,19 +73,19 @@ class PublicTimeline extends BaseApi
|
||||||
$condition[0] .= " AND `parent` = ?";
|
$condition[0] .= " AND `parent` = ?";
|
||||||
$condition[] = $conversation_id;
|
$condition[] = $conversation_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,49 +39,49 @@ class UserTimeline extends BaseApi
|
||||||
{
|
{
|
||||||
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $_REQUEST]);
|
Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $_REQUEST]);
|
||||||
|
|
||||||
$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['user_id'] ?? 0, $uid);
|
$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['user_id'] ?? 0, $uid);
|
||||||
$since_id = $_REQUEST['since_id'] ?? 0;
|
$since_id = $_REQUEST['since_id'] ?? 0;
|
||||||
$max_id = $_REQUEST['max_id'] ?? 0;
|
$max_id = $_REQUEST['max_id'] ?? 0;
|
||||||
$exclude_replies = !empty($_REQUEST['exclude_replies']);
|
$exclude_replies = !empty($_REQUEST['exclude_replies']);
|
||||||
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
$conversation_id = $_REQUEST['conversation_id'] ?? 0;
|
||||||
|
|
||||||
// pagination
|
// pagination
|
||||||
$count = $_REQUEST['count'] ?? 20;
|
$count = $_REQUEST['count'] ?? 20;
|
||||||
$page = $_REQUEST['page'] ?? 1;
|
$page = $_REQUEST['page'] ?? 1;
|
||||||
|
|
||||||
$start = max(0, ($page - 1) * $count);
|
$start = max(0, ($page - 1) * $count);
|
||||||
|
|
||||||
$condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`)) AND `gravity` IN (?, ?) AND `id` > ? AND `author-id` = ?",
|
$condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`)) AND `gravity` IN (?, ?) AND `id` > ? AND `author-id` = ?",
|
||||||
0, $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, $cid];
|
0, $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $since_id, $cid];
|
||||||
|
|
||||||
if ($exclude_replies) {
|
if ($exclude_replies) {
|
||||||
$condition[0] .= ' AND `gravity` = ?';
|
$condition[0] .= ' AND `gravity` = ?';
|
||||||
$condition[] = GRAVITY_PARENT;
|
$condition[] = GRAVITY_PARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conversation_id > 0) {
|
if ($conversation_id > 0) {
|
||||||
$condition[0] .= " AND `parent` = ?";
|
$condition[0] .= " AND `parent` = ?";
|
||||||
$condition[] = $conversation_id;
|
$condition[] = $conversation_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max_id > 0) {
|
if ($max_id > 0) {
|
||||||
$condition[0] .= " AND `id` <= ?";
|
$condition[0] .= " AND `id` <= ?";
|
||||||
$condition[] = $max_id;
|
$condition[] = $max_id;
|
||||||
}
|
}
|
||||||
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
|
||||||
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
$statuses = Post::selectForUser($uid, [], $condition, $params);
|
||||||
|
|
||||||
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
$include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true');
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
while ($status = DBA::fetch($statuses)) {
|
while ($status = DBA::fetch($statuses)) {
|
||||||
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
$ret[] = DI::twitterStatus()->createFromUriId($status['uri-id'], $status['uid'], $include_entities)->toArray();
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
||||||
DI::apiResponse()->exit('user', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
DI::apiResponse()->exit('user', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ class Show extends BaseApi
|
||||||
$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['user_id'] ?? 0, $uid);
|
$cid = BaseApi::getContactIDForSearchterm($_REQUEST['screen_name'] ?? '', $_REQUEST['user_id'] ?? 0, $uid);
|
||||||
|
|
||||||
$user_info = DI::twitterUser()->createFromContactId($cid, $uid)->toArray();
|
$user_info = DI::twitterUser()->createFromContactId($cid, $uid)->toArray();
|
||||||
|
|
||||||
// "uid" is only needed for some internal stuff, so remove it from here
|
// "uid" is only needed for some internal stuff, so remove it from here
|
||||||
unset($user_info['uid']);
|
unset($user_info['uid']);
|
||||||
|
|
||||||
DI::apiResponse()->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
|
DI::apiResponse()->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user