X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnotes.php;h=608d01cf8c63fbf1ed718788ab0eba5f5ffd3db6;hb=dd2d680258e1c594cc585fa31108da5a151a6e47;hp=99114add8c87a6e2971f65f0795b19d3b17eca3d;hpb=b03db4643f7f2874f881d576263e5b5446980e17;p=friendica.git diff --git a/mod/notes.php b/mod/notes.php index 99114add8c..608d01cf8c 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -2,12 +2,13 @@ /** * @file mod/notes.php */ + use Friendica\App; use Friendica\Content\Nav; use Friendica\Core\L10n; -use Friendica\Database\DBM; -use Friendica\Model\Profile; +use Friendica\Database\DBA; use Friendica\Model\Item; +use Friendica\Model\Profile; function notes_init(App $a) { @@ -57,35 +58,36 @@ function notes_content(App $a, $update = false) $o .= status_editor($a, $x, $a->contact['id']); } - $condition = ["`uid` = ? AND `type` = 'note' AND `id` = `parent` AND NOT `wall` - AND `allow_cid` = ? AND `contact-id` = ?", - local_user(), '<' . $a->contact['id'] . '>', $a->contact['id']]; - - $notes = dba::count('item', $condition); + $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT, + 'wall' => false, 'contact-id'=> $a->contact['id']]; - $a->set_pager_total($notes); $a->set_pager_itemspage(40); $params = ['order' => ['created' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]]; - $r = Item::selectForUser(local_user(), ['item_id'], $condition, $params); + $r = Item::selectForUser(local_user(), ['id'], $condition, $params); - if (DBM::is_result($r)) { + $count = 0; + + if (DBA::isResult($r)) { + $count = count($r); $parents_arr = []; while ($rr = Item::fetch($r)) { - $parents_arr[] = $rr['item_id']; + $parents_arr[] = $rr['id']; } - dba::close($r); + DBA::close($r); $condition = ['uid' => local_user(), 'parent' => $parents_arr]; $result = Item::selectForUser(local_user(), [], $condition); - if (DBM::is_result($result)) { + + if (DBA::isResult($result)) { $items = conv_sort(Item::inArray($result), 'commented'); $o .= conversation($a, $items, 'notes', $update); } } - $o .= paginate($a); + $o .= alt_pager($a, $count); + return $o; }