diff options
author | Olivier Migeot <olivier+github@migeot.org> | 2013-11-27 14:03:55 +0100 |
---|---|---|
committer | Olivier Migeot <olivier+github@migeot.org> | 2013-11-27 14:03:55 +0100 |
commit | c3c2ff6cdbaa89b03dc88f88bb5dd75779a249ea (patch) | |
tree | dab55b8bd4d58bc9c2f762998a797471bbfdbc01 | |
parent | 11983c12429021565f2400f893d85b5d4c6f9779 (diff) | |
parent | 64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8 (diff) | |
download | volse-hubzilla-c3c2ff6cdbaa89b03dc88f88bb5dd75779a249ea.tar.gz volse-hubzilla-c3c2ff6cdbaa89b03dc88f88bb5dd75779a249ea.tar.bz2 volse-hubzilla-c3c2ff6cdbaa89b03dc88f88bb5dd75779a249ea.zip |
Merge branch 'master' of https://github.com/friendica/red
-rw-r--r-- | include/zot.php | 31 | ||||
-rw-r--r-- | mod/zfinger.php | 2 |
2 files changed, 10 insertions, 23 deletions
diff --git a/include/zot.php b/include/zot.php index 65f3b606f..0e92b0bff 100644 --- a/include/zot.php +++ b/include/zot.php @@ -18,33 +18,20 @@ function zot_new_uid($channel_nick) { /** - * - * Given an array of zot hashes, return all distinct hubs - * If primary is true, return only primary hubs - * Result is ordered by url to assist in batching. - * Return only the first primary hub as there should only be one. + * @function zot_get_hublocs($hash) + * Given a zot hash, return all distinct hubs + * @param string $hash - xchan_hash + * @retuns array * */ -function zot_get_hubloc($arr,$primary = false) { - - $tmp = ''; - - if(is_array($arr)) { - foreach($arr as $e) { - if(strlen($tmp)) - $tmp .= ','; - $tmp .= "'" . dbesc($e) . "'" ; - } - } - - if(! strlen($tmp)) - return array(); +function zot_get_hublocs($hash) { - $sql_extra = (($primary) ? " and hubloc_flags & " . intval(HUBLOC_FLAGS_PRIMARY) : "" ); - $limit = (($primary) ? " limit 1 " : ""); - return q("select * from hubloc where hubloc_hash in ( $tmp ) $sql_extra order by hubloc_url $limit"); + $ret = q("select * from hubloc where hubloc_hash = '%s' group by hubloc_url ", + dbesc($hash) + ); + return $ret; } /* diff --git a/mod/zfinger.php b/mod/zfinger.php index 59cef5549..2eb6adc75 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -164,7 +164,7 @@ function zfinger_init(&$a) { $ret['locations'] = array(); - $x = zot_get_hubloc(array($e['channel_hash'])); + $x = zot_get_hublocs($e['channel_hash']); if($x && count($x)) { foreach($x as $hub) { if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) { |