diff options
author | zotlabs <mike@macgirvin.com> | 2018-02-01 15:09:51 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-02-01 15:09:51 -0800 |
commit | c92bb6176a79ef575c9a9b5dec8fde7034c6421c (patch) | |
tree | e5d7ab89470466279dd41b1ae4d3a58d85396cb3 /include/hubloc.php | |
parent | feae454481457497cbe5cfffe0c83c297170172f (diff) | |
download | volse-hubzilla-c92bb6176a79ef575c9a9b5dec8fde7034c6421c.tar.gz volse-hubzilla-c92bb6176a79ef575c9a9b5dec8fde7034c6421c.tar.bz2 volse-hubzilla-c92bb6176a79ef575c9a9b5dec8fde7034c6421c.zip |
more separation of complex code into separate functions
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/hubloc.php b/include/hubloc.php index 0daa5908c..d5abda7fb 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -257,6 +257,38 @@ function hubloc_mark_as_down($posturl) { } +/** + * @brief return comma separated string of non-dead clone locations (net addresses) for a given netid + * + * @param string $netid network identity (typically xchan_hash or hubloc_hash) + * @return string + */ + +function locations_by_netid($netid) { + + $strloc = ''; + + $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' and hubloc_deleted = 0 and site_dead = 0", + dbesc($netid) + ); + + if($locs) { + foreach($locs as $l) { + if(!($l['location'])) + continue; + if(strpos($strloc,$l['location']) !== false) + continue; + if(strlen($strloc)) + $strloc .= ', '; + $strloc .= $l['location']; + } + } + + return $strloc; + +} + + function ping_site($url) { |