aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/zot.php b/include/zot.php
index 9777f7ae4..124fe7fd6 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -691,6 +691,16 @@ function import_xchan($arr,$ud_flags = 1) {
dbesc($xchan_hash)
);
+ // See if a primary is specified
+
+ $has_primary = false;
+ foreach($arr['locations'] as $location) {
+ if($location['primary']) {
+ $has_primary = true;
+ break;
+ }
+ }
+
foreach($arr['locations'] as $location) {
if(! rsa_verify($location['url'],base64url_decode($location['url_sig']),$arr['key'])) {
logger('import_xchan: Unable to verify site signature for ' . $location['url']);
@@ -698,6 +708,12 @@ function import_xchan($arr,$ud_flags = 1) {
continue;
}
+ // Ensure that they have one primary hub
+
+ if(! $has_primary)
+ $location['primary'] = true;
+
+
for($x = 0; $x < count($xisting); $x ++) {
if(($xisting[$x]['hubloc_url'] === $location['url']) && ($xisting[$x]['hubloc_sitekey'] === $location['sitekey'])) {
$xisting[$x]['updated'] = true;