Merge pull request #4702 from annando/sql-fix

Fixed SQL query
This commit is contained in:
rabuzarus 2018-03-28 13:43:17 +02:00 committed by GitHub
commit 6dc6581aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,13 +78,12 @@ function directory_content(App $a)
(`profile`.`prv_keywords` LIKE '%$search%'))"; (`profile`.`prv_keywords` LIKE '%$search%'))";
} }
$publish = ((Config::get('system', 'publish_all')) ? '' : " AND `publish` = 1 " ); $publish = (Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 " );
$cnt = dba::selectFirst("SELECT COUNT(*) AS `total` FROM `profile` $cnt = dba::fetch_first("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra " WHERE `is-default` $publish AND NOT `user`.`blocked` $sql_extra");
);
if (DBM::is_result($cnt)) { if (DBM::is_result($cnt)) {
$a->set_pager_total($cnt['total']); $a->set_pager_total($cnt['total']);
} }