Merge branch 'views' of github.com:annando/friendica into views

This commit is contained in:
Michael 2020-04-26 06:31:31 +00:00
commit 832ac65248

View file

@ -887,13 +887,14 @@ class Profile
*/ */
public static function searchProfiles($start = 0, $count = 100, $search = null) public static function searchProfiles($start = 0, $count = 100, $search = null)
{ {
$publish = (DI::config()->get('system', 'publish_all') ? 'true' : "`publish` = 1"); $publish = (DI::config()->get('system', 'publish_all') ? '' : "AND `publish` = 1");
$total = 0; $total = 0;
if (!empty($search)) { if (!empty($search)) {
$searchTerm = '%' . $search . '%'; $searchTerm = '%' . $search . '%';
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `owner-view` $cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `owner-view`
WHERE $publish AND NOT `blocked` AND NOT `account_removed` WHERE NOT `blocked` AND NOT `account_removed`
$publish
AND ((`name` LIKE ?) OR AND ((`name` LIKE ?) OR
(`nickname` LIKE ?) OR (`nickname` LIKE ?) OR
(`about` LIKE ?) OR (`about` LIKE ?) OR
@ -905,7 +906,7 @@ class Profile
$searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm); $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm);
} else { } else {
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` $cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total`
FROM `owner-view` WHERE $publish AND NOT `blocked` AND NOT `account_removed`"); FROM `owner-view` WHERE NOT `blocked` AND NOT `account_removed` $publish");
} }
if (DBA::isResult($cnt)) { if (DBA::isResult($cnt)) {
@ -921,7 +922,8 @@ class Profile
$searchTerm = '%' . $search . '%'; $searchTerm = '%' . $search . '%';
$profiles = DBA::p("SELECT * FROM `owner-view` $profiles = DBA::p("SELECT * FROM `owner-view`
WHERE $publish AND NOT `blocked` AND NOT `account_removed` WHERE NOT `blocked` AND NOT `account_removed`
$publish
AND ((`name` LIKE ?) OR AND ((`name` LIKE ?) OR
(`nickname` LIKE ?) OR (`nickname` LIKE ?) OR
(`about` LIKE ?) OR (`about` LIKE ?) OR
@ -936,7 +938,13 @@ class Profile
); );
} else { } else {
$profiles = DBA::p("SELECT * FROM `owner-view` $profiles = DBA::p("SELECT * FROM `owner-view`
WHERE $publish AND NOT `blocked` AND NOT `account_removed` $order LIMIT ?,?", $start, $count); WHERE NOT `blocked` AND NOT `account_removed`
$publish
$order
LIMIT ?, ?",
$start,
$count
);
} }
} }