X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontacts.php;h=fb4595739b5e1f3047ddf67d1b4bb0b6075e2fb8;hb=15cae001d947d27a75147aecec089e44d7b8c31f;hp=f84a988c8df8524952b0cfb0f933bfbb06612bc5;hpb=be090cc8513504edcfaf368915e45308711f7e7c;p=friendica.git diff --git a/mod/contacts.php b/mod/contacts.php index f84a988c8d..fb4595739b 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -479,12 +479,13 @@ function contacts_content(&$a) { - + $searching = false; if($search) { $search_hdr = $search; - $search = dbesc($search.'*'); + $search_txt = dbesc(protect_sprintf(preg_quote($search))); + $searching = true; } - $sql_extra .= ((strlen($search)) ? " AND MATCH `name` AGAINST ('$search' IN BOOLEAN MODE) " : ""); + $sql_extra .= (($searching) ? " AND `name` REGEXP '$search_txt' " : ""); if($nets) $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); @@ -501,7 +502,6 @@ function contacts_content(&$a) { } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", intval($_SESSION['uid']), intval($a->pager['start']), @@ -568,7 +568,7 @@ function contacts_content(&$a) { '$total' => $total, '$search' => $search_hdr, '$desc' => t('Search your contacts'), - '$finding' => (strlen($search) ? t('Finding: ') . "'" . $search . "'" : ""), + '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""), '$submit' => t('Find'), '$cmd' => $a->cmd, '$contacts' => $contacts,