more generalisation of commonly used code constructs
This commit is contained in:
@@ -266,25 +266,11 @@ function hubloc_mark_as_down($posturl) {
|
||||
|
||||
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;
|
||||
return array_elm_to_str($locs,'location',', ');
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user