diff options
author | git-marijus <mario@mariovavti.com> | 2017-06-03 10:13:42 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2017-06-03 10:13:42 +0200 |
commit | c4ed04fc827ec5a1039959e260702141083836c8 (patch) | |
tree | e3657117a4cc1a7229e6477e2a8886a03397fdb0 | |
parent | 56f3b121712edcfa9a33178dccd89fadd0549642 (diff) | |
download | volse-hubzilla-c4ed04fc827ec5a1039959e260702141083836c8.tar.gz volse-hubzilla-c4ed04fc827ec5a1039959e260702141083836c8.tar.bz2 volse-hubzilla-c4ed04fc827ec5a1039959e260702141083836c8.zip |
convert randprof to use chanlink_hash() instead of chanlink_url() and filter sys channels by xchan.xchan_system instead of xchan_addr != sys@%
-rw-r--r-- | Zotlabs/Module/Randprof.php | 2 | ||||
-rw-r--r-- | include/connections.php | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Zotlabs/Module/Randprof.php b/Zotlabs/Module/Randprof.php index dc2e925fe..94ec095cb 100644 --- a/Zotlabs/Module/Randprof.php +++ b/Zotlabs/Module/Randprof.php @@ -8,7 +8,7 @@ class Randprof extends \Zotlabs\Web\Controller { function init() { $x = random_profile(); if($x) - goaway(chanlink_url($x)); + goaway(chanlink_hash($x)); /** FIXME this doesn't work at the moment as a fallback */ goaway(z_root() . '/profile'); diff --git a/include/connections.php b/include/connections.php index 8f4f84e1a..167f7e2c4 100644 --- a/include/connections.php +++ b/include/connections.php @@ -415,9 +415,9 @@ function random_profile() { for($i = 0; $i < $retryrandom; $i++) { - $r = q("select xchan_url from xchan left join hubloc on hubloc_hash = xchan_hash where xchan_addr not like '%s' and xchan_hidden = 0 and hubloc_connected > %s - interval %s order by $randfunc limit 1", - dbesc('sys@%'), - db_utcnow(), db_quoteinterval('30 day') + $r = q("select xchan_url, xchan_hash from xchan left join hubloc on hubloc_hash = xchan_hash where xchan_hidden = 0 and xchan_system = 0 and hubloc_connected > %s - interval %s order by $randfunc limit 1", + db_utcnow(), + db_quoteinterval('30 day') ); if(!$r) return ''; // Couldn't get a random channel @@ -425,12 +425,12 @@ function random_profile() { if($checkrandom) { $x = z_fetch_url($r[0]['xchan_url']); if($x['success']) - return $r[0]['xchan_url']; + return $r[0]['xchan_hash']; else logger('Random channel turned out to be bad.'); } else { - return $r[0]['xchan_url']; + return $r[0]['xchan_hash']; } } @@ -712,4 +712,4 @@ function vcard_query(&$r) { } } } -}
\ No newline at end of file +} |