aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Activity.php20
-rw-r--r--Zotlabs/Lib/Libzot.php30
-rw-r--r--Zotlabs/Lib/Queue.php25
3 files changed, 44 insertions, 31 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index a93ad9d23..372ef3dd7 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -2252,11 +2252,11 @@ class Activity {
// over-ride the object timestamp with the activity
- if ($act->data['published']) {
+ if (isset($act->data['published'])) {
$s['created'] = datetime_convert('UTC', 'UTC', $act->data['published']);
}
- if ($act->data['updated']) {
+ if (isset($act->data['updated'])) {
$s['edited'] = datetime_convert('UTC', 'UTC', $act->data['updated']);
}
@@ -2710,7 +2710,7 @@ class Activity {
// This is a zot6 packet and the raw activitypub or diaspora message json
// is possibly available in the attachement.
- if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) {
+ if (array_key_exists('signed', $raw_arr) && isset($act->data['attachment']) && is_array($act->data['attachment'])) {
foreach($act->data['attachment'] as $a) {
if (
isset($a['type']) && $a['type'] === 'PropertyValue' &&
@@ -2730,7 +2730,7 @@ class Activity {
}
// old style: can be removed after most hubs are on 7.0.2
- elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) {
+ elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && isset($act->data['attachment']) && is_array($act->obj['attachment'])) {
foreach($act->obj['attachment'] as $a) {
if (
isset($a['type']) && $a['type'] === 'PropertyValue' &&
@@ -3019,30 +3019,34 @@ class Activity {
dbesc($item['parent_mid']),
intval($item['uid'])
);
+
if (!$parent) {
if (!plugin_is_installed('pubcrawl')) {
return;
}
else {
$fetch = false;
+
// TODO: debug
// if (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') && (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce')) {
if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || $is_sys_channel) {
$fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel, $observer_hash, $item, $force) : false);
}
+
if ($fetch) {
$parent = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($item['parent_mid']),
intval($item['uid'])
);
}
- else {
- logger('no parent');
- return;
- }
}
}
+ if (!$parent) {
+ logger('no parent');
+ return;
+ }
+
if ($parent[0]['parent_mid'] !== $item['parent_mid']) {
$item['thr_parent'] = $item['parent_mid'];
}
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 340f844d5..8bf3c51d5 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -904,11 +904,11 @@ class Libzot {
$s = Libsync::sync_locations($arr, $arr);
if ($s) {
- if ($s['change_message'])
+ if (isset($s['change_message']))
$what .= $s['change_message'];
- if ($s['changed'])
+ if (isset($s['changed']))
$changed = $s['changed'];
- if ($s['message'])
+ if (isset($s['message']))
$ret['message'] .= $s['message'];
}
@@ -1769,7 +1769,7 @@ class Libzot {
dbesc($arr['author_xchan'])
);
- if (intval($arr['item_deleted'])) {
+ if (isset($arr['item_deleted']) && $arr['item_deleted']) {
// remove_community_tag is a no-op if this isn't a community tag activity
self::remove_community_tag($sender, $arr, $channel['channel_id']);
@@ -2020,11 +2020,11 @@ class Libzot {
$arr['owner_xchan'] = $a['signature']['signer'];
}
- if ($AS->meta['hubloc'] || $arr['author_xchan'] === $arr['owner_xchan']) {
+ if (isset($AS->meta['hubloc']) || $arr['author_xchan'] === $arr['owner_xchan']) {
$arr['item_verified'] = true;
}
- if ($AS->meta['signed_data']) {
+ if (isset($AS->meta['signed_data'])) {
IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false);
$j = json_decode($AS->meta['signed_data'], true);
if ($j) {
@@ -2518,14 +2518,14 @@ class Libzot {
$access_policy = ACCESS_PRIVATE;
}
- $directory_url = htmlspecialchars((string)$arr['directory_url'], ENT_COMPAT, 'UTF-8', false);
- $url = htmlspecialchars((string)strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false);
- $sellpage = htmlspecialchars((string)$arr['sellpage'], ENT_COMPAT, 'UTF-8', false);
- $site_location = htmlspecialchars((string)$arr['location'], ENT_COMPAT, 'UTF-8', false);
- $site_realm = htmlspecialchars((string)$arr['realm'], ENT_COMPAT, 'UTF-8', false);
- $site_project = htmlspecialchars((string)$arr['project'], ENT_COMPAT, 'UTF-8', false);
- $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars((string)implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : '');
- $site_version = ((array_key_exists('version', $arr)) ? htmlspecialchars((string)$arr['version'], ENT_COMPAT, 'UTF-8', false) : '');
+ $directory_url = ((isset($arr['directory_url'])) ? htmlspecialchars($arr['directory_url'], ENT_COMPAT, 'UTF-8', false) : '');
+ $url = ((isset($arr['url'])) ? htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false) : '');
+ $sellpage = ((isset($arr['sellpage'])) ? htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false) : '');
+ $site_location = ((isset($arr['location'])) ? htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false) : '');
+ $site_realm = ((isset($arr['realm'])) ? htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false) : '');
+ $site_project = ((isset($arr['project'])) ? htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false) : '');
+ $site_crypto = ((isset($arr['encryption']) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : '');
+ $site_version = ((isset($arr['version'])) ? htmlspecialchars($arr['version'], ENT_COMPAT, 'UTF-8', false) : '');
// You can have one and only one primary directory per realm.
// Downgrade any others claiming to be primary. As they have
@@ -3198,7 +3198,7 @@ class Libzot {
}
foreach ($arr as $v) {
- if ($v[$check] === 'zot6') {
+ if (isset($v[$check]) && $v[$check] === 'zot6') {
return $v;
}
}
diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php
index 246b42667..a646aee6d 100644
--- a/Zotlabs/Lib/Queue.php
+++ b/Zotlabs/Lib/Queue.php
@@ -110,21 +110,30 @@ class Queue {
return false;
}
+ $hash = $arr['hash'] ?? '';
+ $account_id = $arr['account_id'] ?? 0;
+ $channel_id = $arr['channel_id'] ?? 0;
+ $driver = $arr['driver'] ?? 'zot6';
+ $posturl = $arr['posturl'] ?? '';
+ $priority = $arr['priority'] ?? 0;
+ $priority = $arr['notify'] ?? '';
+ $msg = $arr['msg'] ?? '';
+
$x = q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_priority,
outq_created, outq_updated, outq_scheduled, outq_notify, outq_msg )
values ( '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s' )",
- dbesc($arr['hash']),
- intval($arr['account_id']),
- intval($arr['channel_id']),
- dbesc(($arr['driver']) ? $arr['driver'] : 'zot6'),
- dbesc($arr['posturl']),
+ dbesc($hash),
+ intval($account_id),
+ intval($channel_id),
+ dbesc($driver),
+ dbesc($posturl),
intval(1),
- intval(isset($arr['priority']) ? $arr['priority'] : 0),
+ intval($priority),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
- dbesc($arr['notify']),
- dbesc(($arr['msg']) ? $arr['msg'] : '')
+ dbesc($notify),
+ dbesc($msg)
);
return $x;