From: Michael Date: Tue, 28 Aug 2018 20:44:39 +0000 (+0000) Subject: Use item class instead of direct call X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=47ca5bbf715d36e46ffd9b88956315646c157b75;p=friendica.git Use item class instead of direct call --- diff --git a/mod/community.php b/mod/community.php index 9c9fb43900..685eda6da0 100644 --- a/mod/community.php +++ b/mod/community.php @@ -11,6 +11,7 @@ use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\Item; function community_init(App $a) { @@ -227,19 +228,12 @@ function community_getitems($start, $itemspage, $content, $accounttype) return DBA::toArray($r); } elseif ($content == 'global') { if (!is_null($accounttype)) { - $sql_accounttype = " AND `owner`.`contact-type` = ?"; - $values = [$accounttype, $start, $itemspage]; + $condition = ["`uid` = ? AND `owner`.`contact-type` = ?", 0, $accounttype]; } else { - $sql_accounttype = ""; - $values = [$start, $itemspage]; + $condition = ['uid' => 0]; } - $r = DBA::p("SELECT `uri` FROM `thread` - INNER JOIN `item` ON `item`.`id` = `thread`.`iid` - INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id` - INNER JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id` - WHERE `thread`.`uid` = 0 AND NOT `author`.`hidden` AND NOT `author`.`blocked` $sql_accounttype - ORDER BY `thread`.`commented` DESC LIMIT ?, ?", $values); + $r = Item::selectThreadForUser(0, ['uri'], $condition, ['order' => ['commented' => true], 'limit' => [$start, $itemspage]]); return DBA::toArray($r); }