From e18f3844da70e2f1496b0c67016153d6e486cfd2 Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Sat, 3 Mar 2018 19:31:15 +0100 Subject: [PATCH 1/2] fix page counter in directory module --- mod/directory.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/directory.php b/mod/directory.php index b8b0482127..e547e54b9f 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -81,9 +81,11 @@ function directory_content(App $a) $publish = ((Config::get('system', 'publish_all')) ? '' : " AND `publish` = 1 " ); - $total = q("SELECT COUNT(*) AS `total` FROM `profile` - LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` - WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra " + $total = dba::inArray( + dba::p("SELECT COUNT(*) AS `total` FROM `profile` + LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` + WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra " + ) ); if (DBM::is_result($total)) { $a->set_pager_total($total[0]['total']); From d572738e95aa15a4b5a6598bcc0c9f5ea54c9afa Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Sat, 3 Mar 2018 20:08:41 +0100 Subject: [PATCH 2/2] directory - use dba::select_first() --- mod/directory.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mod/directory.php b/mod/directory.php index e547e54b9f..5f3605ebff 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -81,14 +81,12 @@ function directory_content(App $a) $publish = ((Config::get('system', 'publish_all')) ? '' : " AND `publish` = 1 " ); - $total = dba::inArray( - dba::p("SELECT COUNT(*) AS `total` FROM `profile` + $cnt = dba::select_first("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra " - ) ); - if (DBM::is_result($total)) { - $a->set_pager_total($total[0]['total']); + if (DBM::is_result($cnt)) { + $a->set_pager_total($cnt['total']); } $order = " ORDER BY `name` ASC ";