aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-05-26 11:25:36 +0000
committerMario <mario@mariovavti.com>2021-05-26 11:25:36 +0000
commitb7f124072fd8d4fec5b0c1ec1e56b3b854f640e7 (patch)
tree63e1e5a072f63171239bedd5caeabbb0ea7601c3 /include
parentec02eda11323fe27d2b23e6d289eb3d97c9eddc9 (diff)
downloadvolse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.tar.gz
volse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.tar.bz2
volse-hubzilla-b7f124072fd8d4fec5b0c1ec1e56b3b854f640e7.zip
import_author_xchan(): do not import legacy zot
Diffstat (limited to 'include')
-rw-r--r--include/items.php72
1 files changed, 19 insertions, 53 deletions
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);
}