diff options
author | Mario <mario@mariovavti.com> | 2021-05-26 11:25:36 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-26 11:25:36 +0000 |
commit | b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7 (patch) | |
tree | 63e1e5a072f63171239bedd5caeabbb0ea7601c3 | |
parent | ec02eda11323fe27d2b23e6d289eb3d97c9eddc9 (diff) | |
download | volse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.tar.gz volse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.tar.bz2 volse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.zip |
import_author_xchan(): do not import legacy zot
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 6 | ||||
-rw-r--r-- | include/items.php | 72 |
2 files changed, 22 insertions, 56 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index c7d001d21..5cd304679 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2664,9 +2664,9 @@ class Libzot { // we may only end up with one; which results in posts with no author name or photo and are a bit // of a hassle to repair. If either or both are missing, do a full discovery probe. - //if (!array_key_exists('id', $x)) { - //return import_author_activitypub($x); - //} + if(!isset($x['id']) && !isset($x['key']) && !isset($x['id_sig'])) { + return false; + } $hash = self::make_xchan_hash($x['id'], $x['key']); diff --git a/include/items.php b/include/items.php index 5f80b9f51..a45a266a7 100644 --- a/include/items.php +++ b/include/items.php @@ -909,71 +909,37 @@ function get_item_elements($x,$allow_code = false) { function import_author_xchan($x) { - $arr = [ - 'xchan' => $x, - 'xchan_hash' => '' - ]; - /** - * @hooks import_author_xchan - * Called when looking up an author of a post by xchan_hash to ensure they have an xchan record on our site. - * * \e array \b xchan - * * \e string \b xchan_hash - Thre returned value - */ - call_hooks('import_author_xchan', $arr); - if($arr['xchan_hash']) { - return $arr['xchan_hash']; + if (!$x) { + return false; } $y = false; - if((isset($x['id']) && isset($x['key'])) && (!isset($x['network']) || $x['network'] === 'zot6')) { + if (!array_key_exists('network', $x) || $x['network'] === 'zot6') { $y = Libzot::import_author_zot($x); } - if(!$y && isset($x['url']) && isset($x['network']) && $x['network'] === 'zot6') { - $r = q("SELECT xchan_hash FROM xchan WHERE xchan_url = '%s' AND xchan_network = 'zot6'", - dbesc($x['url']) - ); - if($r) - $y = $r[0]['xchan_hash']; - else - $y = discover_by_webbie($x['url'], 'zot6'); - } - - // if we were told that it's a zot6 connection, don't probe/import anything else - - if($y) + // if we were told that it's a zot connection, don't probe/import anything else + if (array_key_exists('network', $x) && $x['network'] === 'zot6') return $y; - if(!isset($x['network']) || $x['network'] === 'zot') { - $y = import_author_zot($x); - } - - if(isset($x['network']) || $x['network'] === 'zot') { - if($x['url']) { - // check if we already have the zot6 xchan of this xchan_url. if not import it. - $r = q("SELECT xchan_hash FROM xchan WHERE xchan_url = '%s' AND xchan_network = 'zot6'", - dbesc($x['url']) - ); - // TODO: fix dupplicate with line 960 - if(!$r) - discover_by_webbie($x['url'], 'zot6'); - } - - if($y) - return $y; - - } + $hookinfo = [ + 'xchan' => $x, + 'xchan_hash' => '' + ]; - // perform zot6 discovery - if($x['url']) { - $y = discover_by_webbie($x['url'], 'zot6'); - if($y) { - return $y; - } + /** + * @hooks import_author_xchan + * Called when looking up an author of a post by xchan_hash to ensure they have an xchan record on our site. + * * \e array \b xchan + * * \e string \b xchan_hash - Thre returned value + */ + call_hooks('import_author_xchan', $hookinfo); + if($hookinfo['xchan_hash']) { + return $hookinfo['xchan_hash']; } - if($x['network'] === 'rss') { + if(!$y && array_key_exists('network', $x) && $x['network'] === 'rss') { $y = import_author_rss($x); } |