aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Acl.php
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2018-10-25 03:38:05 +0200
committerM. Dent <dentm42@gmail.com>2018-10-25 03:38:05 +0200
commit9cedc864c296ad3fb394692440551c97bc644522 (patch)
tree1174444a974f017fffbb1537357022e2e0688e38 /Zotlabs/Module/Acl.php
parenta0a72a9f6d9e59ddf386a481e57dc64b882ff7ab (diff)
parentee804cd6b197457c2a51e2d37dbd1b03ca76917c (diff)
downloadvolse-hubzilla-9cedc864c296ad3fb394692440551c97bc644522.tar.gz
volse-hubzilla-9cedc864c296ad3fb394692440551c97bc644522.tar.bz2
volse-hubzilla-9cedc864c296ad3fb394692440551c97bc644522.zip
Merge branch 'dev' into 'dev'
Editor contact autocomplete performance & refine stream filter and forum notification behaviour (mostly for performance) See merge request hubzilla/core!1348
Diffstat (limited to 'Zotlabs/Module/Acl.php')
-rw-r--r--Zotlabs/Module/Acl.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index ea131e08c..738e8fbe2 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -83,7 +83,8 @@ class Acl extends \Zotlabs\Web\Controller {
if($search) {
$sql_extra = " AND pgrp.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
$sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc(punify($search)) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
-
+ $sql_extra2_xchan = "AND ( xchan_name LIKE " . protect_sprintf( "'" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'" . dbesc(punify($search)) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
+
// This horrible mess is needed because position also returns 0 if nothing is found.
// Would be MUCH easier if it instead returned a very large value
// Otherwise we could just
@@ -226,7 +227,7 @@ class Acl extends \Zotlabs\Web\Controller {
else { // Visitors
$r = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags, 0 as abook_self
FROM xchan left join xlink on xlink_link = xchan_hash
- WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" ,
+ WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2_xchan order by $order_extra2 xchan_name asc" ,
dbesc(get_observer_hash())
);
@@ -270,7 +271,7 @@ class Acl extends \Zotlabs\Web\Controller {
if((count($r) < 100) && $type == 'c') {
$r2 = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags, 0 as abook_self
FROM xchan
- WHERE xchan_deleted = 0 and not xchan_network in ('rss','anon','unknown') $sql_extra2 order by $order_extra2 xchan_name asc"
+ WHERE xchan_deleted = 0 and not xchan_network in ('rss','anon','unknown') $sql_extra2_xchan order by $order_extra2 xchan_name asc"
);
if($r2) {
$r = array_merge($r,$r2);