aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-02-24 21:35:22 +0000
committerMario <mario@mariovavti.com>2023-02-24 21:35:22 +0000
commitfd3adf4d11c3c9f2ff92389b315da90f2a47c1b7 (patch)
tree4c1f423b634407f47d2737d967de620f195a0843 /Zotlabs/Module
parentc42911bd8db98129beb9412c9b7fd9fd3860b80c (diff)
downloadvolse-hubzilla-fd3adf4d11c3c9f2ff92389b315da90f2a47c1b7.tar.gz
volse-hubzilla-fd3adf4d11c3c9f2ff92389b315da90f2a47c1b7.tar.bz2
volse-hubzilla-fd3adf4d11c3c9f2ff92389b315da90f2a47c1b7.zip
slightly improve contact search
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Connections.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index ea30b9b9e..e0f463c76 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -145,6 +145,7 @@ class Connections extends \Zotlabs\Web\Controller {
}
$search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : '');
+ $search_xchan = ((x($_REQUEST,'search_xchan')) ? notags(trim($_REQUEST['search_xchan'])) : '');
$tabs = array(
/*
@@ -233,10 +234,15 @@ class Connections extends \Zotlabs\Web\Controller {
if($search) {
$search_hdr = $search;
- $search_txt = dbesc(protect_sprintf(preg_quote($search)));
- $searching = true;
+ $search_txt = (($search_xchan) ? urldecode($search_xchan) : preg_quote($search));
+
+ if ($search_xchan) {
+ $sql_extra .= " AND xchan_hash = '" . protect_sprintf(dbesc($search_txt)) . "' ";
+ }
+ else {
+ $sql_extra .= " AND xchan_name LIKE '%%" . protect_sprintf(dbesc($search_txt)) . "%%' ";
+ }
}
- $sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
if(isset($_REQUEST['gid']) && $_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from pgrp_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
@@ -396,7 +402,7 @@ class Connections extends \Zotlabs\Web\Controller {
'$search' => $search_hdr,
'$label' => t('Search'),
'$role_label' => t('Contact role'),
- '$desc' => t('Search your connections'),
+ '$desc' => $search ?? t('Search your connections'),
'$finding' => (($searching) ? t('Contact search') . ": '" . $search . "'" : ""),
'$submit' => t('Find'),
'$edit' => t('Edit'),