aboutsummaryrefslogtreecommitdiffstats
path: root/mod/import.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-26 13:49:07 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-26 13:49:07 -0700
commitda649e397e63e71d8111f4b6be1d569f5ad2d319 (patch)
tree750116fb438ceedcf010df523957f56fda207b27 /mod/import.php
parent250d286f1dd8ee9ca244df25946e56b09ee5ff18 (diff)
downloadvolse-hubzilla-da649e397e63e71d8111f4b6be1d569f5ad2d319.tar.gz
volse-hubzilla-da649e397e63e71d8111f4b6be1d569f5ad2d319.tar.bz2
volse-hubzilla-da649e397e63e71d8111f4b6be1d569f5ad2d319.zip
import fixes
Diffstat (limited to 'mod/import.php')
-rw-r--r--mod/import.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/mod/import.php b/mod/import.php
index 2961867a8..b3d0859e4 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -225,10 +225,36 @@ function import_post(&$a) {
foreach($hublocs as $hubloc) {
$arr = array(
'guid' => $hubloc['hubloc_guid'],
- 'guid_sig' => $hubloc['guid_sig'],
+ 'guid_sig' => $hubloc['hubloc_guid_sig'],
'url' => $hubloc['hubloc_url'],
'url_sig' => $hubloc['hubloc_url_sig']
);
+
+ $hash = make_xchan_hash($hubloc['hubloc_guid'],$hubloc['hubloc_guid_sig']);
+ if($hubloc['hubloc_network'] === 'zot' && $hash !== $hubloc['hubloc_hash']) {
+ logger('forged hubloc: ' . print_r($hubloc,true));
+ continue;
+ }
+
+ if(array_key_exists('hubloc_primary',$hubloc)) {
+ if(intval($hubloc['hubloc_primary']) {
+ $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_PRIMARY;
+ unset($hubloc['hubloc_primary']);
+ }
+ if(intval($hubloc['hubloc_orphancheck']) {
+ $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_ORPHANCHECK;
+ unset($hubloc['hubloc_orphancheck']);
+ }
+ if(intval($hubloc['hubloc_deleted']) {
+ $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_DELETED;
+ unset($hubloc['hubloc_deleted']);
+ }
+ if(intval($hubloc['hubloc_error']) {
+ $hubloc['hubloc_status'] |= HUBLOC_ERROR;
+ unset($hubloc['hubloc_error']);
+ }
+ }
+
if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && ($seize))
$hubloc['hubloc_flags'] = ($hubloc['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY);
@@ -308,6 +334,12 @@ function import_post(&$a) {
if($xchans) {
foreach($xchans as $xchan) {
+ $hash = make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_guid_sig']);
+ if($xchan['xchan_network'] === 'zot' && $hash !== $xchan['xchan_hash']) {
+ logger('forged xchan: ' . print_r($xchan,true));
+ continue;
+ }
+
$r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1",
dbesc($xchan['xchan_hash'])
);