aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Import.php20
-rw-r--r--Zotlabs/Module/Import_progress.php39
-rw-r--r--Zotlabs/Module/Siteinfo.php4
-rw-r--r--Zotlabs/Module/Sse_bs.php6
-rw-r--r--Zotlabs/Module/Wall_attach.php14
-rw-r--r--include/api_zot.php3
-rw-r--r--include/attach.php14
-rw-r--r--include/connections.php8
-rw-r--r--include/items.php17
-rw-r--r--view/tpl/siteinfo.tpl2
10 files changed, 99 insertions, 28 deletions
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index e8968c6bd..24b7498dd 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -525,14 +525,21 @@ class Import extends Controller {
// This will indirectly perform a refresh_all *and* update the directory
Master::Summon(['Directory', $channel['channel_id']]);
- $cf_api_compat = true;
+ if ($api_path) {
+ $parsed = parse_url($api_path);
+ unset($parsed['path']);
- if ($api_path && $import_posts) { // we are importing from a server and not a file
- if (version_compare($data['compatibility']['version'], '6.3.4', '>=')) {
+ // store the import host so we can manually kick off item/file sync later in case anything did not work out
+ set_pconfig($channel['channel_id'], 'import', 'host', $parsed['host']);
+
+ $hz_server = unparse_url($parsed);
+ }
- $m = parse_url($api_path);
+ $cf_api_compat = false;
- $hz_server = $m['scheme'] . '://' . $m['host'];
+ if ($api_path && $hz_server && $import_posts) { // we are importing from a server and not a file
+ if (version_compare($data['compatibility']['version'], '6.3.4', '>=')) {
+ $cf_api_compat = true;
$since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00');
$until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day');
@@ -543,9 +550,6 @@ class Import extends Controller {
Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]);
Master::Summon(['File_importer', sprintf('%d', $page), $channel['channel_address'], urlencode($hz_server)]);
}
- else {
- $cf_api_compat = false;
- }
}
change_channel($channel['channel_id']);
diff --git a/Zotlabs/Module/Import_progress.php b/Zotlabs/Module/Import_progress.php
index 5c68f9ff1..d9b13e8a8 100644
--- a/Zotlabs/Module/Import_progress.php
+++ b/Zotlabs/Module/Import_progress.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use App;
use Zotlabs\Lib\PConfig;
use Zotlabs\Daemon\Master;
@@ -21,6 +22,9 @@ class Import_progress extends \Zotlabs\Web\Controller {
nav_set_selected('Channel Import');
+ $channel = App::get_channel();
+ $import_host = PConfig::Get(local_channel(), 'import', 'host');
+
// items
$c = PConfig::Get(local_channel(), 'import', 'content_progress');
@@ -41,6 +45,24 @@ class Import_progress extends \Zotlabs\Web\Controller {
}
}
else {
+ if(argv(1) === 'resume_itemsync' && $import_host) {
+ $alive = probe_api_path($import_host);
+ if ($alive) {
+ $parsed = parse_url($alive);
+ unset($parsed['path']);
+
+ $hz_server = unparse_url($parsed);
+ $since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00');
+ $until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day');
+ $page = 0;
+ Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]);
+ goaway('/import_progress');
+ }
+ else {
+ notice(t('Import host does not seem to be online or compatible') . EOL);
+ }
+ }
+
$cprogress = 'waiting to start...';
if (PConfig::Get(local_channel(), 'import', 'content_completed')) {
@@ -73,6 +95,23 @@ class Import_progress extends \Zotlabs\Web\Controller {
}
}
else {
+ if(argv(1) === 'resume_filesync' && $import_host) {
+ $alive = probe_api_path($import_host);
+ if ($alive) {
+ $parsed = parse_url($alive);
+ unset($parsed['path']);
+
+ $hz_server = unparse_url($parsed);
+ $page = 0;
+
+ Master::Summon(['File_importer', sprintf('%d', $page), $channel['channel_address'], urlencode($hz_server)]);
+ goaway('/import_progress');
+ }
+ else {
+ notice(t('Import host does not seem to be online or compatible') . EOL);
+ }
+ }
+
$fprogress = 'waiting to start...';
if (PConfig::Get(local_channel(), 'import', 'files_completed')) {
diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php
index df6a334d8..3cad64a13 100644
--- a/Zotlabs/Module/Siteinfo.php
+++ b/Zotlabs/Module/Siteinfo.php
@@ -29,8 +29,8 @@ class Siteinfo extends \Zotlabs\Web\Controller {
'$terms' => t('Terms of Service'),
'$prj_header' => t('Software and Project information'),
'$prj_name' => t('This site is powered by $Projectname'),
- '$prj_transport' => t('Federated and decentralised networking and identity services provided by Zot'),
- '$transport_link' => '<a href="https://zotlabs.org">https://zotlabs.org</a>',
+ '$prj_transport' => t('Federated and decentralised networking and identity services provided by'),
+ '$transport_link' => '<a href="https://hubzilla.org">https://hubzilla.org</a>',
'$additional_text' => t('Additional federated transport protocols:'),
'$additional_fed' => implode(', ', $federated),
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index a18301a1a..09c4ed614 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -590,6 +590,7 @@ class Sse_bs extends Controller {
if($forums) {
$item_normal = item_normal();
+ $p_sql = '';
$sql_extra = '';
if(! (self::$vnotify & VNOTIFY_LIKE))
@@ -599,6 +600,7 @@ class Sse_bs extends Controller {
$i = 0;
for($x = 0; $x < $fcount; $x ++) {
+ /*
$p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'",
intval(self::$uid),
intval(TERM_FORUM),
@@ -607,14 +609,16 @@ class Sse_bs extends Controller {
$p_str = ids_to_querystr($p, 'parent');
$p_sql = (($p_str) ? "OR parent IN ( $p_str )" : '');
+ */
$r = q("select count(*) as total from item
- where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and item_unseen = 1 $sql_extra $item_normal",
+ where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and verb != 'Announce' and item_unseen = 1 $sql_extra $item_normal",
intval(self::$uid),
dbesc($forums[$x]['xchan_hash']),
dbesc($forums[$x]['xchan_hash'])
);
+
if($r[0]['total']) {
$forums[$x]['notify_link'] = z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id'];
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 0d5c9e983..3c57d4b94 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -104,32 +104,32 @@ class Wall_attach extends \Zotlabs\Web\Controller {
}
if(intval($r['data']['is_photo'])) {
- $s = "\n\n" . $r['body'] . "\n\n";
+ $s = $r['body'];
}
else {
- if(strpos($r['data']['filetype'],'video') === 0) {
+ if(strpos($r['data']['filetype'], 'video') === 0) {
// give a wee bit of time for the background thumbnail processor to do its thing
// or else we'll never see a video poster
sleep(3);
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
$thumb = Linkinfo::get_video_poster($url);
if($thumb) {
- $s = "\n\n" . '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]' . "\n\n";
+ $s = '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]';
}
else {
- $s = "\n\n" . '[zvideo]' . $url . '[/zvideo]' . "\n\n";
+ $s = '[zvideo]' . $url . '[/zvideo]';
}
}
if(strpos($r['data']['filetype'],'audio') === 0) {
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
- $s = "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
+ $s = '[zaudio]' . $url . '[/zaudio]';
}
if ($r['data']['filetype'] === 'image/svg+xml') {
$x = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
if ($x) {
$bb = svg2bb($x);
if ($bb) {
- $s .= "\n\n" . $bb;
+ $s .= $bb;
}
else {
logger('empty return from svgbb');
@@ -140,7 +140,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
}
}
- $s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
+ $s .= '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]';
}
$sync = attach_export_data($channel,$r['data']['hash']);
diff --git a/include/api_zot.php b/include/api_zot.php
index 22692b962..56cec005d 100644
--- a/include/api_zot.php
+++ b/include/api_zot.php
@@ -546,6 +546,7 @@
return false;
}
+
logger('api_red_item_store: REQUEST ' . print_r($_REQUEST,true));
logger('api_red_item_store: FILES ' . print_r($_FILES,true));
@@ -561,7 +562,7 @@
$mod = new Zotlabs\Module\Wall_attach();
$media = $mod->post();
if($media)
- $_REQUEST['body'] = $media . "\n\n" . $_REQUEST['body'];
+ $_REQUEST['body'] = $media . "\n" . $_REQUEST['body'];
}
$mod = new Zotlabs\Module\Item();
diff --git a/include/attach.php b/include/attach.php
index efefc73a4..2283da1c6 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2982,11 +2982,17 @@ function save_chunk($channel,$start,$end,$len) {
$result = [];
- $tmp_path = $_FILES['files']['tmp_name'];
+ $file = $_FILES['files'] ?? $_FILES['userfile'] ?? [];
+
+ if (!$file) {
+ return $result;
+ }
+
+ $tmp_path = $file['tmp_name'];
$new_base = 'store/[data]/' . $channel['channel_address'] . '/tmp';
os_mkdir($new_base,STORAGE_DEFAULT_PERMISSIONS,true);
- $new_path = $new_base . '/' . $_FILES['files']['name'];
+ $new_path = $new_base . '/' . $file['name'];
if(file_exists($new_path) && intval($start) === 0) {
$result['partial'] = true;
@@ -3008,8 +3014,8 @@ function save_chunk($channel,$start,$end,$len) {
}
if(($len - 1) == $end) {
unlink($tmp_path);
- $result['name'] = $_FILES['files']['name'];
- $result['type'] = $_FILES['files']['type'];
+ $result['name'] = $file['name'];
+ $result['type'] = $file['type'];
$result['tmp_name'] = $new_path;
$result['error'] = 0;
$result['size'] = $len;
diff --git a/include/connections.php b/include/connections.php
index e5cc90411..efc531171 100644
--- a/include/connections.php
+++ b/include/connections.php
@@ -68,6 +68,14 @@ function rconnect_url($channel_id,$xchan) {
}
+/**
+ * @brief returns deliverable xchans for a channel.
+ *
+ * @param intval $channel_id
+ * @param array $filter (optional)
+ * @param boolean $flatten (optional)
+ */
+
function deliverable_abook_xchans($channel_id, $filter = [], $flatten = true) {
$filter_sql = '';
diff --git a/include/items.php b/include/items.php
index efc45db38..2300f70ef 100644
--- a/include/items.php
+++ b/include/items.php
@@ -36,10 +36,10 @@ require_once('include/permissions.php');
* @param boolean $include_groups
* @return array containing the recipients
*/
-function collect_recipients($item, &$private_envelope,$include_groups = true) {
+function collect_recipients($item, &$private_envelope, $include_groups = true) {
$private_envelope = ((intval($item['item_private'])) ? true : false);
- $recipients = array();
+ $recipients = [];
if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) {
@@ -54,8 +54,15 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$allow_groups = [];
}
- $raw_recipients = array_unique(array_merge($allow_people, $allow_groups));
- $recipients = deliverable_abook_xchans($item['uid'], $raw_recipients);
+ $recipients = array_unique(array_merge($allow_people, $allow_groups));
+
+ if ($recipients) {
+ // deliverable_abook_xchans() will return all deliverable xchans
+ // if passed an empty array as 2nd argument (no filtering).
+ // Hence only call it if we do actually have any recipients.
+ $recipients = deliverable_abook_xchans($item['uid'], $recipients);
+ }
+
// if you specifically deny somebody but haven't allowed anybody, we'll allow everybody in your
// address book minus the denied connections. The post is still private and can't be seen publicly
@@ -201,6 +208,8 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$recipients[] = $item['owner_xchan'];
}
+hz_syslog(print_r($recipients, true));
+
return $recipients;
}
diff --git a/view/tpl/siteinfo.tpl b/view/tpl/siteinfo.tpl
index 6cf7da756..08e4790f2 100644
--- a/view/tpl/siteinfo.tpl
+++ b/view/tpl/siteinfo.tpl
@@ -55,7 +55,7 @@
<div>{{$prj_src}}</div>
<br><br>
-<div>{{$prj_transport}} ({{$transport_link}})</div>
+<div>{{$prj_transport}} {{$transport_link}}</div>
{{if $additional_fed}}
<div>{{$additional_text}} {{$additional_fed}}</div>