more separation of complex code into separate functions
This commit is contained in:
parent
feae454481
commit
c92bb6176a
@ -826,27 +826,10 @@ class Connedit extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$locstr = '';
|
$locstr = locations_by_netid($contact['xchan_hash']);
|
||||||
|
if(! $locstr)
|
||||||
$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($contact['xchan_hash'])
|
|
||||||
);
|
|
||||||
|
|
||||||
if($locs) {
|
|
||||||
foreach($locs as $l) {
|
|
||||||
if(!($l['location']))
|
|
||||||
continue;
|
|
||||||
if(strpos($locstr,$l['location']) !== false)
|
|
||||||
continue;
|
|
||||||
if(strlen($locstr))
|
|
||||||
$locstr .= ', ';
|
|
||||||
$locstr .= $l['location'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$locstr = $contact['xchan_url'];
|
$locstr = $contact['xchan_url'];
|
||||||
|
|
||||||
$clone_warn = '';
|
$clone_warn = '';
|
||||||
$clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false);
|
$clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false);
|
||||||
if(! $clonable) {
|
if(! $clonable) {
|
||||||
|
@ -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) {
|
function ping_site($url) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user