}
logger("Unrecognized user-agent ".$_SERVER['HTTP_USER_AGENT'], LOGGER_DEBUG);
+ } else {
+ logger("Empty user-agent", LOGGER_DEBUG);
}
- logger("Empty user-agent", LOGGER_DEBUG);
-
return "api";
}
'base' => System::baseUrl(),
'updated' => api_date(null),
'atom_updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
- 'language' => $user_info['language'],
+ 'language' => $user_info['lang'],
'logo' => System::baseUrl() . "/images/friendica-32.png",
];
'geo_enabled' => false,
'verified' => false,
'statuses_count' => 0,
- 'language' => '',
+ 'lang' => '',
'contributors_enabled' => false,
'is_translator' => false,
'is_translation_enabled' => false,
'geo_enabled' => false,
'verified' => true,
'statuses_count' => intval($countitems),
- 'language' => '',
+ 'lang' => '',
'contributors_enabled' => false,
'is_translator' => false,
'is_translation_enabled' => false,
// get last public wall message
$condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
- $lastwall = dba::selectFirst('item', [], $condition, ['order' => ['id' => true]]);
+ $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
if (DBM::is_result($lastwall)) {
$in_reply_to = api_in_reply_to($lastwall);
'in_reply_to_screen_name' => $in_reply_to['screen_name'],
'user' => $user_info,
$geo => null,
- 'coordinates' => "",
- 'place' => "",
- 'contributors' => "",
+ 'coordinates' => '',
+ 'place' => '',
+ 'contributors' => '',
'is_quote_status' => false,
'retweet_count' => 0,
'favorite_count' => 0,
'favorited' => $lastwall['starred'] ? true : false,
'retweeted' => false,
'possibly_sensitive' => false,
- 'language' => "",
+ 'lang' => '',
'statusnet_html' => $converted["html"],
'statusnet_conversation_id' => $lastwall['parent'],
- 'external_url' => System::baseUrl() . "/display/" . $lastwall['guid'],
+ 'external_url' => System::baseUrl() . '/display/' . $lastwall['guid'],
];
if (count($converted["attachments"]) > 0) {
$condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'private' => false];
- $lastwall = dba::selectFirst('item', [], $condition, ['order' => ['id' => true]]);
+ $lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
if (DBM::is_result($lastwall)) {
$in_reply_to = api_in_reply_to($lastwall);
$conversation = !empty($_REQUEST['conversation']);
// try to fetch the item for the local user - or the public item, if there is no local one
- $uri_item = dba::selectFirst('item', ['uri'], ['id' => $id]);
+ $uri_item = Item::selectFirst(['uri'], ['id' => $id]);
if (!DBM::is_result($uri_item)) {
throw new BadRequestException("There is no status with this id.");
}
- $item = dba::selectFirst('item', ['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
+ $item = Item::selectFirst(['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
if (!DBM::is_result($item)) {
throw new BadRequestException("There is no status with this id.");
}
logger('API: api_conversation_show: '.$id);
// try to fetch the item for the local user - or the public item, if there is no local one
- $item = dba::selectFirst('item', ['parent-uri'], ['id' => $id]);
+ $item = Item::selectFirst(['parent-uri'], ['id' => $id]);
if (!DBM::is_result($item)) {
throw new BadRequestException("There is no status with this id.");
}
- $parent = dba::selectFirst('item', ['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
+ $parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
if (!DBM::is_result($parent)) {
throw new BadRequestException("There is no status with this id.");
}
dbesc($_POST['screen_name'])
);
- // Selecting the id by priority, friendica first
- api_best_nickname($r);
+ if (DBM::is_result($r)) {
+ // Selecting the id by priority, friendica first
+ api_best_nickname($r);
- $recipient = api_get_user($a, $r[0]['nurl']);
+ $recipient = api_get_user($a, $r[0]['nurl']);
+ }
} else {
$recipient = api_get_user($a, $_POST['user_id']);
}
+ if (empty($recipient)) {
+ throw new NotFoundException('Recipient not found');
+ }
+
$replyto = '';
$sub = '';
if (x($_REQUEST, 'replyto')) {