Fix important bug (created on ffdbab1) that was miss-ordering accounts in results (DANGEROUS)

This commit is contained in:
Bofh 2022-12-16 18:01:18 +01:00
parent 0dac8435dd
commit 0d5b7e9800
1 changed files with 4 additions and 3 deletions

View File

@ -171,6 +171,8 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '')
foreach ($all_accounts as $account) foreach ($all_accounts as $account)
{ {
$ai++;
$acct_for_trusted = $account['username'].'@'.($account['domain'] === null ? $acct_for_trusted = $account['username'].'@'.($account['domain'] === null ?
$GLOBALS['ap_instance'] : $account['domain']); $GLOBALS['ap_instance'] : $account['domain']);
if (in_array($acct_for_trusted, $trusted_users) || if (in_array($acct_for_trusted, $trusted_users) ||
@ -181,7 +183,6 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '')
if (content_cache__exists($ckey) !== false) if (content_cache__exists($ckey) !== false)
continue; continue;
$ai++;
$a_note = trim($account['note']); $a_note = trim($account['note']);
$a_fields = json_decode($account['fields'], true); $a_fields = json_decode($account['fields'], true);
$fields = ''; $fields = '';
@ -228,8 +229,8 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '')
if ($matches) { if ($matches) {
$filtered_accounts []= $account['id']; $filtered_accounts []= $account['id'];
$filtered_accounts_index[$account['id']] = $ai; $filtered_accounts_index[$account['id']] = $ai;
if ($user_filter !== 'remote') if ($user_filter !== 'remote') continue;
continue;
$count_matches++; $count_matches++;
if ($paging !== null && $count_matches >= $paging[1] && !$enable_caching) if ($paging !== null && $count_matches >= $paging[1] && !$enable_caching)
$enable_caching = true; $enable_caching = true;