aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dirsearch.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-05 19:16:50 -0800
committerfriendica <info@friendica.com>2015-03-05 19:16:50 -0800
commitbd4d2f3b44face9d265c28c84e9ca9eb85d1ee7d (patch)
tree02fa8f9e982594c28cc4b47891d8252da194b181 /mod/dirsearch.php
parentea8ea5a351d36b3575c98ccb0dda58805186d154 (diff)
downloadvolse-hubzilla-bd4d2f3b44face9d265c28c84e9ca9eb85d1ee7d.tar.gz
volse-hubzilla-bd4d2f3b44face9d265c28c84e9ca9eb85d1ee7d.tar.bz2
volse-hubzilla-bd4d2f3b44face9d265c28c84e9ca9eb85d1ee7d.zip
make alpahabetic searches start with A
Diffstat (limited to 'mod/dirsearch.php')
-rw-r--r--mod/dirsearch.php41
1 files changed, 36 insertions, 5 deletions
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 12abfafb8..01cbccbed 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -186,8 +186,10 @@ function dirsearch_content(&$a) {
}
- if($sort_order == 'normal')
+ if($sort_order == 'normal') {
$order = " order by xchan_name asc ";
+ $safesql .= " and ascii(substr(xchan_name FROM 1 FOR 1)) > 64 ";
+ }
elseif($sort_order == 'reverse')
$order = " order by xchan_name desc ";
elseif($sort_order == 'reversedate')
@@ -238,15 +240,44 @@ function dirsearch_content(&$a) {
json_return_and_die($spkt);
}
else {
- $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $safesql $order $qlimit ",
+
+ // The query mangling is designed to make alphabetic searches start with 'A' and not precede real names
+ // with those containing a bunch of punctuation
+
+ if($sort_order == 'normal') {
+ $sql = $safesql .= " and ascii(substr(xchan_name FROM 1 FOR 1)) > 64 ";
+ }
+ else {
+ $sql = $safesql;
+ }
+
+ $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $sql $order $qlimit ",
intval(XCHAN_FLAGS_HIDDEN),
intval(XCHAN_FLAGS_ORPHAN),
intval(XCHAN_FLAGS_DELETED)
);
- }
- $ret['page'] = $page + 1;
- $ret['records'] = count($r);
+ $ret['page'] = $page + 1;
+ $ret['records'] = count($r);
+
+
+ if(! $r) {
+
+ if($sort_order == 'normal') {
+ $sql = $safesql .= " and ascii(substr(xchan_name FROM 1 FOR 1)) <= 64 ";
+
+ $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $sql $order $qlimit ",
+ intval(XCHAN_FLAGS_HIDDEN),
+ intval(XCHAN_FLAGS_ORPHAN),
+ intval(XCHAN_FLAGS_DELETED)
+ );
+
+ $ret['page'] = $page + 1;
+ $ret['records'] = count($r);
+
+ }
+ }
+ }
if($r) {