diff options
author | Mario <mario@mariovavti.com> | 2022-11-04 10:31:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-11-04 10:31:05 +0000 |
commit | 5502f1cc63d87bed8198d360ae0e8e7c5fa58f44 (patch) | |
tree | f65e899b792ef86f99539b06232e5baf2fe80714 | |
parent | b55801323c19928fc7cb82c007856087e3d6545a (diff) | |
download | volse-hubzilla-5502f1cc63d87bed8198d360ae0e8e7c5fa58f44.tar.gz volse-hubzilla-5502f1cc63d87bed8198d360ae0e8e7c5fa58f44.tar.bz2 volse-hubzilla-5502f1cc63d87bed8198d360ae0e8e7c5fa58f44.zip |
do not update the guid on xchan/hubloc updates and define some array keys
-rw-r--r-- | Zotlabs/Lib/Activity.php | 8 | ||||
-rw-r--r-- | include/event.php | 27 |
2 files changed, 23 insertions, 12 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b93df8a02..963a8ff75 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1702,9 +1702,8 @@ class Activity { ); // update existing xchan record - q("update xchan set xchan_name = '%s', xchan_guid = '%s', xchan_pubkey = '%s', xchan_addr = '%s', xchan_network = 'activitypub', xchan_name_date = '%s' where xchan_hash = '%s'", + q("update xchan set xchan_name = '%s', xchan_pubkey = '%s', xchan_addr = '%s', xchan_network = 'activitypub', xchan_name_date = '%s' where xchan_hash = '%s'", dbesc(escape_tags($name)), - dbesc($url), dbesc(escape_tags($pubkey)), dbesc(escape_tags($webfinger_addr)), dbescdate(datetime_convert()), @@ -1712,8 +1711,7 @@ class Activity { ); // update existing hubloc record - q("update hubloc set hubloc_guid = '%s', hubloc_addr = '%s', hubloc_network = 'activitypub', hubloc_url = '%s', hubloc_host = '%s', hubloc_callback = '%s', hubloc_updated = '%s', hubloc_id_url = '%s' where hubloc_hash = '%s'", - dbesc($url), + q("update hubloc set hubloc_addr = '%s', hubloc_network = 'activitypub', hubloc_url = '%s', hubloc_host = '%s', hubloc_callback = '%s', hubloc_updated = '%s', hubloc_id_url = '%s' where hubloc_hash = '%s'", dbesc(escape_tags($webfinger_addr)), dbesc($baseurl), dbesc($hostname), @@ -2208,6 +2206,8 @@ class Activity { $s['owner_xchan'] = $act->actor['id']; $s['author_xchan'] = $act->actor['id']; + $content = []; + if (is_array($act->obj)) { $content = self::get_content($act->obj); } diff --git a/include/event.php b/include/event.php index 0805bd2fe..7c81d6934 100644 --- a/include/event.php +++ b/include/event.php @@ -503,11 +503,22 @@ function ev_compare($a, $b) { function event_store_event($arr) { - $arr['created'] = (($arr['created']) ? $arr['created'] : datetime_convert()); - $arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert()); - $arr['etype'] = (($arr['etype']) ? $arr['etype'] : 'event' ); - $arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : ''); - $arr['event_priority'] = (($arr['event_priority']) ? $arr['event_priority'] : 0); + $arr['created'] = $arr['created'] ?? datetime_convert(); + $arr['edited'] = $arr['edited'] ?? datetime_convert(); + $arr['etype'] = $arr['etype'] ?? 'event'; + $arr['event_xchan'] = $arr['event_xchan'] ?? ''; + $arr['event_priority'] = $arr['event_priority'] ?? 0; + $arr['location'] = $arr['location'] ?? ''; + $arr['nofinish'] = $arr['nofinish'] ?? 0; + $arr['event_status'] = $arr['event_status'] ?? ''; + $arr['event_percent'] = $arr['event_percent'] ?? 0; + $arr['event_repeat'] = $arr['event_repeat'] ?? ''; + $arr['event_sequence'] = $arr['event_sequence'] ?? 0; + $arr['event_vdata'] = $arr['event_vdata'] ?? ''; + $arr['allow_cid'] = $arr['allow_cid'] ?? ''; + $arr['allow_gid'] = $arr['allow_gid'] ?? ''; + $arr['deny_cid'] = $arr['deny_cid'] ?? ''; + $arr['deny_gid'] = $arr['deny_gid'] ?? ''; if (! $arr['dtend']) { $arr['dtend'] = NULL_DATE; @@ -522,7 +533,7 @@ function event_store_event($arr) { $existing_event = null; - if($arr['event_hash']) { + if(isset($arr['event_hash'])) { $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", dbesc($arr['event_hash']), intval($arr['uid']) @@ -532,7 +543,7 @@ function event_store_event($arr) { } } - if($arr['id']) { + if(isset($arr['id'])) { $r = q("SELECT * FROM event WHERE id = %d AND uid = %d LIMIT 1", intval($arr['id']), intval($arr['uid']) @@ -1169,7 +1180,7 @@ function event_store_item($arr, $event) { $item = null; - if($arr['mid'] && $arr['uid']) { + if(isset($arr['mid'], $arr['uid'])) { $i = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($arr['mid']), intval($arr['uid']) |