}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$data['status'] = api_format_items(dba::inArray($statuses), $user_info);
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$items = dba::inArray($statuses);
}
$params = ['order' => ['iid' => true], 'limit' => [$start, $count]];
- $statuses = Item::selectThread(api_user(), [], $condition, $params);
+ $statuses = Item::selectThreadForUser(api_user(), Item::DISPLAY_FIELDLIST, $condition, $params);
$r = dba::inArray($statuses);
} else {
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$r = dba::inArray($statuses);
}
}
$params = ['order' => ['iid' => true], 'limit' => [$start, $count]];
- $statuses = Item::selectThread(api_user(), [], $condition, $params);
+ $statuses = Item::selectThreadForUser(api_user(), Item::DISPLAY_FIELDLIST, $condition, $params);
$ret = api_format_items(dba::inArray($statuses), $user_info, false, $type);
$params = [];
}
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
/// @TODO How about copying this to above methods which don't check $r ?
- if (!DBM::is_result($items)) {
+ if (!DBM::is_result($statuses)) {
throw new BadRequestException("There is no status with this id.");
}
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
- if (!DBM::is_result($items)) {
+ if (!DBM::is_result($statuses)) {
throw new BadRequestException("There is no status with id $id.");
}
logger('API: api_statuses_repeat: '.$id);
$fields = ['body', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
- $item = Item::selectFirst(api_user(), $fields, ['id' => $id, 'private' => false]);
+ $item = Item::selectFirst($fields, ['id' => $id, 'private' => false]);
if (DBM::is_result($item) && $item['body'] != "") {
if (strpos($item['body'], "[/share]") !== false) {
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$ret = api_format_items(dba::inArray($statuses), $user_info, false, $type);
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$ret = api_format_items(dba::inArray($statuses), $user_info, true, $type);
$itemid = intval($_REQUEST['id']);
}
- $item = Item::selectFirst(api_user(), [], ['id' => $itemid, 'uid' => api_user()]);
+ $item = Item::selectFirstForUser(api_user(), [], ['id' => $itemid, 'uid' => api_user()]);
if (!DBM::is_result($item)) {
throw new BadRequestException("Invalid item.");
$condition[] = $max_id;
}
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$ret = api_format_items(dba::inArray($statuses), $user_info, false, $type);
}
}
$params = ['order' => ['id' => true], 'limit' => [$start, $count]];
- $statuses = Item::select(api_user(), [], $condition, $params);
+ $statuses = Item::selectForUser(api_user(), [], $condition, $params);
$items = api_format_items(dba::inArray($statuses), $user_info, false, $type);
function api_direct_messages_box($type, $box, $verbose)
{
$a = get_app();
- $user_info = api_get_user($a);
-
- if (api_user() === false || $user_info === false) {
+ if (api_user() === false) {
throw new ForbiddenException();
}
-
// params
$count = (x($_GET, 'count') ? $_GET['count'] : 20);
$page = (x($_REQUEST, 'page') ? $_REQUEST['page'] -1 : 0);
unset($_REQUEST["screen_name"]);
unset($_GET["screen_name"]);
+ $user_info = api_get_user($a);
+ if ($user_info === false) {
+ throw new ForbiddenException();
+ }
$profile_url = $user_info["url"];
// pagination
function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $filetype, $visibility = false)
{
// get data about the api authenticated user
- $uri = item_new_uri(get_app()->get_hostname(), intval(api_user()));
+ $uri = Item::newURI(intval(api_user()));
$owner_record = q("SELECT * FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user()));
$arr = [];
$condition = ["`parent` = ? AND `uid` = ? AND (`verb` = ? OR `type`='photo')",
$item[0]['parent'], api_user(), ACTIVITY_POST];
- $statuses = Item::select(api_user(), [], $condition);
+ $statuses = Item::selectForUser(api_user(), [], $condition);
// prepare output of comments
$commentData = api_format_items(dba::inArray($statuses), $user_info, false, $type);
$nm->setSeen($note);
if ($note['otype']=='item') {
// would be really better with an ItemsManager and $im->getByID() :-P
- $item = Item::selectFirst(api_user(), [], ['id' => $note['iid'], 'uid' => api_user()]);
+ $item = Item::selectFirstForUser(api_user(), [], ['id' => $note['iid'], 'uid' => api_user()]);
if (DBM::is_result($$item)) {
// we found the item, return it to the user
$ret = api_format_items([$item], $user_info, false, $type);