diff --git a/api/v1/database/mastodon/accounts/search/index.php b/api/v1/database/mastodon/accounts/search/index.php index c4c4508..37fc581 100644 --- a/api/v1/database/mastodon/accounts/search/index.php +++ b/api/v1/database/mastodon/accounts/search/index.php @@ -31,19 +31,13 @@ $sql_all = ' ORDER BY a.updated_at DESC '; -$user_filter = 'all'; +$user_filter = 'local'; if (isset($_GET['user_filter'])) { $user_filter = strtolower(trim($_GET['user_filter'])); - if (!in_array($user_filter, ['all','local','remote'])) - $user_filter = 'all'; + if (!in_array($user_filter, ['local','remote'])) + $user_filter = 'local'; } switch ($user_filter) { - case 'all': - $sql_all = str_replace('{userFilter}', '', $sql_all); - $sql_all = str_replace('{userLocalInnerJoin}', '', $sql_all); - $sql_all = str_replace('{userLocalWhere1}', '', $sql_all); - $sql_all = str_replace('{userLocalWhere2}', '', $sql_all); - break; case 'local': $sql_all = str_replace('{userFilter}', 'a.domain IS NULL AND', $sql_all); $sql_all = str_replace('{userLocalInnerJoin}', 'INNER JOIN users AS u ON u.account_id = a.id', $sql_all); @@ -70,8 +64,8 @@ else $sql_all = str_replace('{noStatusesWhere}', '', $sql_all); $cache = null; if ($user_filter === 'local') $cache = 'ondemand,60'; -else if (in_array($user_filter, ['all','remote'])) - $cache = 'ondemand,300'; +else if ($user_filter === 'remote') + $cache = 'always,3600'; $all_accounts = $pg->fetch_all($sql_all, $cache); @@ -88,8 +82,9 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '') $a_note = trim($account['note']); $a_fields = json_decode($account['fields'], true); $fields = ''; - foreach ($a_fields as $field) - $fields .= $field['name'].' '.$field['value'].' '; + if (gettype($a_fields) === 'array') + foreach ($a_fields as $field) + $fields .= $field['name'].' '.$field['value'].' '; $a_note = trim($fields) . $a_note; if ($q === '') {