aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Directory.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Directory.php')
-rw-r--r--Zotlabs/Module/Directory.php38
1 files changed, 33 insertions, 5 deletions
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index 5448a4816..8f5db6635 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -103,8 +103,14 @@ class Directory extends \Zotlabs\Web\Controller {
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
-
- $r = suggestion_query(local_channel(),get_observer_hash());
+
+ // the directory options have no effect in suggestion mode
+
+ $globaldir = 1;
+ $safe_mode = 1;
+ $type = 0;
+
+ $r = suggestion_query(local_channel(),get_observer_hash(),0,60);
if(! $r) {
notice( t('No default suggestions were found.') . EOL);
@@ -212,12 +218,17 @@ class Directory extends \Zotlabs\Web\Controller {
if($j) {
if($j['results']) {
-
+
+ $results = $j['results'];
+ if($suggest) {
+ $results = self::reorder_results($results,$addresses);
+ }
+
$entries = array();
$photo = 'thumb';
- foreach($j['results'] as $rr) {
+ foreach($results as $rr) {
$profile_link = chanlink_url($rr['url']);
@@ -438,5 +449,22 @@ class Directory extends \Zotlabs\Web\Controller {
return $o;
}
-
+ static public function reorder_results($results,$suggests) {
+
+ if(! $suggests)
+ return $results;
+
+ $out = [];
+ foreach($suggests as $k => $v) {
+ foreach($results as $rv) {
+ if($k == $rv['address']) {
+ $out[intval($v)] = $rv;
+ break;
+ }
+ }
+ }
+
+ return $out;
+ }
+
}