X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmsearch.php;h=b51757cf7f44f7b46003d5645412362442a6460c;hb=254c32ac91cdfd654e64cdc8ae5aef44ee639212;hp=e87a8f522c8d4ef11aeaa9be41291bc8b58ef48d;hpb=1de3960e267a8d298348fbca18cf1be1f6a20f7a;p=friendica.git diff --git a/mod/msearch.php b/mod/msearch.php index e87a8f522c..b51757cf7f 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -1,8 +1,29 @@ . + * + */ use Friendica\App; -use Friendica\Core\System; use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Model\User; +use Friendica\Util\Proxy; function msearch_post(App $a) { @@ -26,8 +47,7 @@ function msearch_post(App $a) "SELECT COUNT(*) AS `total` FROM `profile` JOIN `user` ON `user`.`uid` = `profile`.`uid` - WHERE `is-default` = 1 - AND `user`.`hidewall` = 0 + WHERE `profile`.`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search ); @@ -42,8 +62,7 @@ function msearch_post(App $a) "SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` JOIN `profile` ON `user`.`uid` = `profile`.`uid` - WHERE `is-default` = 1 - AND `user`.`hidewall` = 0 + WHERE `profile`.`net-publish` AND MATCH(`pub_keywords`) AGAINST (?) LIMIT ?, ?", $search, @@ -51,15 +70,17 @@ function msearch_post(App $a) $perpage ); - while($search_result = DBA::fetch($search_stmt)) { + while ($search_result = DBA::fetch($search_stmt)) { $results[] = [ 'name' => $search_result['name'], - 'url' => System::baseUrl() . '/profile/' . $search_result['nickname'], - 'photo' => System::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg', + 'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'], + 'photo' => User::getAvatarUrlForId($search_result['uid'], Proxy::SIZE_THUMB), 'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords']) ]; } + DBA::close($search_stmt); + $output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results]; echo json_encode($output);