aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Content_importer.php18
-rw-r--r--Zotlabs/Daemon/File_importer.php12
-rw-r--r--Zotlabs/Module/Import.php3
3 files changed, 16 insertions, 17 deletions
diff --git a/Zotlabs/Daemon/Content_importer.php b/Zotlabs/Daemon/Content_importer.php
index adc180a2c..72b8e34ce 100644
--- a/Zotlabs/Daemon/Content_importer.php
+++ b/Zotlabs/Daemon/Content_importer.php
@@ -24,19 +24,19 @@ class Content_importer {
$channel = channelx_by_nick($channel_address);
if(! $channel) {
logger('itemhelper: channel not found');
- killme();
+ return;
}
- $headers = [
+ $headers = [
'X-API-Token' => random_string(),
- 'X-API-Request' => $hz_server . '/api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
+ 'X-API-Request' => $hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
'Host' => $m['host'],
- '(request-target)' => 'get /api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
+ '(request-target)' => 'get /api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
];
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
- $x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,false,$redirects,[ 'headers' => $headers ]);
+ $x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,false,$redirects,[ 'headers' => $headers ]);
if(! $x['success']) {
logger('no API response',LOGGER_DEBUG);
@@ -46,14 +46,14 @@ class Content_importer {
$j = json_decode($x['body'],true);
if (! $j) {
- killme();
+ return;
}
- if(! ($j['item'] || count($j['item'])))
- killme();
+ if(! is_array($j['item']) || ! count($j['item']))
+ return;
import_items($channel,$j['item'],false,((array_key_exists('relocate',$j)) ? $j['relocate'] : null));
- killme();
+ return;
}
}
diff --git a/Zotlabs/Daemon/File_importer.php b/Zotlabs/Daemon/File_importer.php
index f3fe785bb..883759a39 100644
--- a/Zotlabs/Daemon/File_importer.php
+++ b/Zotlabs/Daemon/File_importer.php
@@ -23,18 +23,18 @@ class File_importer {
$channel = channelx_by_nick($channel_address);
if(! $channel) {
logger('filehelper: channel not found');
- killme();
+ return;
}
$headers = [
'X-API-Token' => random_string(),
- 'X-API-Request' => $hz_server . '/api/z/1.0/file/export?f=&zap_compat=1&file_id=' . $attach_id,
+ 'X-API-Request' => $hz_server . '/api/z/1.0/file/export?f=&file_id=' . $attach_id,
'Host' => $m['host'],
- '(request-target)' => 'get /api/z/1.0/file/export?f=&zap_compat=1&file_id=' . $attach_id,
+ '(request-target)' => 'get /api/z/1.0/file/export?f=&file_id=' . $attach_id,
];
- $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),true,'sha512');
- $x = z_fetch_url($hz_server . '/api/z/1.0/file/export?f=&zap_compat=1&file_id=' . $attach_id,false,$redirects,[ 'headers' => $headers ]);
+ $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),true,'sha512');
+ $x = z_fetch_url($hz_server . '/api/z/1.0/file/export?f=&file_id=' . $attach_id,false,$redirects,[ 'headers' => $headers ]);
if(! $x['success']) {
logger('no API response',LOGGER_DEBUG);
@@ -45,6 +45,6 @@ class File_importer {
$r = sync_files($channel,[$j]);
- killme();
+ return;
}
}
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 6324b841d..ecbcc3034 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -246,7 +246,6 @@ class Import extends Controller {
logger('import step 4');
-
// import xchans and contact photos
if (array_key_exists('channel', $data) && $seize) {
@@ -552,7 +551,7 @@ class Import extends Controller {
break;
}
- if (! ($j['item'] || count($j['item']))) {
+ if (! is_array($j['item']) || ! count($j['item'])) {
break;
}