From 6f421a74c68449afbe0007f4b9f400fb0932b0a8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Oct 2018 02:38:54 -0400 Subject: [PATCH] [forumdirectory] Use Content\Pager instead of App->pager --- forumdirectory/forumdirectory.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 0c2aa265..a5d27d4b 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -8,6 +8,7 @@ use Friendica\App; use Friendica\Content\Nav; +use Friendica\Content\Pager; use Friendica\Content\Widget; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -45,8 +46,6 @@ function forumdirectory_init(App $a) { $a->page['htmlhead'] .= ''; - $a->set_pager_itemspage(60); - if (local_user()) { $a->page['aside'] .= Widget::findPeople(); } else { @@ -107,19 +106,22 @@ function forumdirectory_content(App $a) $publish = Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 "; + $total = 0; $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`" . " WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra "); if (DBA::isResult($r)) { - $a->set_pager_total($r[0]['total']); + $total = $r[0]['total']; } + $pager = new Pager($a->query_string, $total, 60); + $order = " ORDER BY `name` ASC "; $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags`" . " FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish" . " AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra $order LIMIT %d , %d ", - intval($a->pager['start']), - intval($a->pager['itemspage']) + $pager->getStart(), + $pager->getItemsPerPage() ); if (DBA::isResult($r)) { @@ -208,7 +210,7 @@ function forumdirectory_content(App $a) } $o .= "
\r\n"; - $o .= paginate($a); + $o .= $pager->renderFull(); } else { info(L10n::t("No entries \x28some entries may be hidden\x29.") . EOL); } -- 2.39.5