1
0
Fork 0

The fetch function now centrally controls the content

This commit is contained in:
Michael 2018-06-24 10:48:29 +00:00
commit b03db4643f
14 changed files with 56 additions and 43 deletions

View file

@ -260,7 +260,7 @@ function acl_content(App $a)
$params = ['order' => ['author-name' => true]];
$authors = Item::selectForUser(local_user(), ['author-link'], $condition, $params);
$item_authors = [];
while ($author = dba::fetch($authors)) {
while ($author = Item::fetch($authors)) {
$item_authors[$author['author-link']] = $author['author-link'];
}
dba::close($authors);

View file

@ -347,7 +347,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
Item::update(['unseen' => false], $condition);
}
$items = conv_sort(dba::inArray($items_obj), "`commented`");
$items = conv_sort(Item::inArray($items_obj), "`commented`");
if (!$update) {
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>";

View file

@ -456,7 +456,7 @@ function networkFlatView(App $a, $update = 0)
$params = ['order' => ['id' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$result = Item::selectForUser(local_user(), [], $condition, $params);
$items = dba::inArray($result);
$items = Item::inArray($result);
$condition = ['unseen' => true, 'uid' => local_user()];
networkSetSeen($condition);

View file

@ -73,7 +73,7 @@ function notes_content(App $a, $update = false)
if (DBM::is_result($r)) {
$parents_arr = [];
while ($rr = dba::fetch($r)) {
while ($rr = Item::fetch($r)) {
$parents_arr[] = $rr['item_id'];
}
dba::close($r);
@ -81,7 +81,7 @@ function notes_content(App $a, $update = false)
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
$result = Item::selectForUser(local_user(), [], $condition);
if (DBM::is_result($result)) {
$items = conv_sort(dba::inArray($result), 'commented');
$items = conv_sort(Item::inArray($result), 'commented');
$o .= conversation($a, $items, 'notes', $update);
}
}

View file

@ -135,7 +135,7 @@ function ping_init(App $a)
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
if (DBM::is_result($items)) {
$items_unseen = dba::inArray($items);
$items_unseen = Item::inArray($items);
$arr = ['items' => $items_unseen];
Addon::callHooks('network_ping', $arr);

View file

@ -339,7 +339,7 @@ function profile_content(App $a, $update = 0)
$condition = ['uid' => $a->profile['profile_uid'], 'parent' => $parents_arr];
$result = Item::selectForUser($a->profile['profile_uid'], [], $condition);
$items = conv_sort(dba::inArray($result), 'created');
$items = conv_sort(Item::inArray($result), 'created');
} else {
$items = [];
}

View file

@ -214,7 +214,7 @@ function search_content(App $a) {
if (!empty($itemids)) {
$params = ['order' => ['id' => true]];
$items = Item::selectForUser(local_user(), [], ['id' => $itemids], $params);
$r = dba::inArray($items);
$r = Item::inArray($items);
} else {
$r = [];
}
@ -227,7 +227,7 @@ function search_content(App $a) {
$params = ['order' => ['id' => true],
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$items = Item::selectForUser(local_user(), [], $condition, $params);
$r = dba::inArray($items);
$r = Item::inArray($items);
}
if (!DBM::is_result($r)) {

View file

@ -21,7 +21,7 @@ function starred_init(App $a) {
killme();
}
$item = Item::selectForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]);
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]);
if (!DBM::is_result($item)) {
killme();
}