aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php33
-rw-r--r--Zotlabs/Lib/Enotify.php12
-rw-r--r--Zotlabs/Module/Feed.php2
-rw-r--r--Zotlabs/Module/Fhubloc_id_url.php58
-rw-r--r--Zotlabs/Update/_1238.php28
5 files changed, 114 insertions, 19 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index b8432f95a..25f19510d 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1456,11 +1456,35 @@ class Activity {
$icon = $person_obj['icon'];
}
- if(is_array($person_obj['url']) && array_key_exists('href', $person_obj['url']))
- $profile = $person_obj['url']['href'];
- else
- $profile = $url;
+ $links = false;
+ $profile = false;
+
+ if (is_array($person_obj['url'])) {
+ if (! array_key_exists(0,$person_obj['url'])) {
+ $links = [ $person_obj['url'] ];
+ }
+ else {
+ $links = $person_obj['url'];
+ }
+ }
+
+ if ($links) {
+ foreach ($links as $link) {
+ if (array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') {
+ $profile = $link['href'];
+ }
+ }
+ if (! $profile) {
+ $profile = $links[0]['href'];
+ }
+ }
+ elseif (isset($person_obj['url']) && is_string($person_obj['url'])) {
+ $profile = $person_obj['url'];
+ }
+ if (! $profile) {
+ $profile = $url;
+ }
$inbox = $person_obj['inbox'];
@@ -1492,6 +1516,7 @@ class Activity {
);
if(! $r) {
// create a new record
+
$r = xchan_store_lowlevel(
[
'xchan_hash' => $url,
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index f706b0fb9..90c498d78 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -856,11 +856,11 @@ class Enotify {
'photo' => $item[$who]['xchan_photo_s'],
'when' => (($edit) ? datetime_convert('UTC', date_default_timezone_get(), $item['edited']) : datetime_convert('UTC', date_default_timezone_get(), $item['created'])),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
- 'b64mid' => 'b64.' . base64url_encode($item['mid']),
+ 'b64mid' => (($item['mid']) ? 'b64.' . base64url_encode($item['mid']) : ''),
//'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])),
- 'notify_id' => 'undefined',
'thread_top' => (($item['item_thread_top']) ? true : false),
'message' => bbcode(escape_tags($itemem_text)),
+ 'body' => htmlentities(html2plain(bbcode($item['body'])), ENT_COMPAT, 'UTF-8', false),
// these are for the superblock addon
'hash' => $item[$who]['xchan_hash'],
'uid' => $item['uid'],
@@ -885,7 +885,6 @@ class Enotify {
$mid = basename($tt['link']);
$b64mid = ((strpos($mid, 'b64.') === 0) ? $mid : 'b64.' . base64url_encode($mid));
-
$x = [
'notify_link' => z_root() . '/notify/view/' . $tt['id'],
'name' => $tt['xname'],
@@ -893,8 +892,8 @@ class Enotify {
'photo' => $tt['photo'],
'when' => datetime_convert('UTC', date_default_timezone_get(), $tt['created']),
'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'),
- 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : 'undefined'),
- 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : 'undefined'),
+ 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : ''),
+ 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''),
'message' => $message
];
@@ -980,8 +979,7 @@ class Enotify {
$x = [
'notify_link' => z_root() . '/admin/accounts',
'name' => $rr['account_email'],
- 'addr' => $rr['account_email'],
- 'url' => '',
+ //'addr' => $rr['account_email'],
'photo' => z_root() . '/' . get_default_profile_photo(48),
'when' => datetime_convert('UTC', date_default_timezone_get(),$rr['account_created']),
'hclass' => ('notify-unseen'),
diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php
index 36869abbe..b5e7b28fa 100644
--- a/Zotlabs/Module/Feed.php
+++ b/Zotlabs/Module/Feed.php
@@ -17,7 +17,7 @@ class Feed extends \Zotlabs\Web\Controller {
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);
$params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0);
$params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0);
- $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 40);
+ $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 10);
$params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc');
$params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 0);
diff --git a/Zotlabs/Module/Fhubloc_id_url.php b/Zotlabs/Module/Fhubloc_id_url.php
new file mode 100644
index 000000000..d332c7400
--- /dev/null
+++ b/Zotlabs/Module/Fhubloc_id_url.php
@@ -0,0 +1,58 @@
+<?php
+namespace Zotlabs\Module;
+
+/* fix missing or hubloc_id_url entries */
+
+class Fhubloc_id_url extends \Zotlabs\Web\Controller {
+
+ function get() {
+
+ if(! is_site_admin())
+ return;
+
+ // fix legacy zot hubloc_id_url
+ $r1 = dbq("UPDATE hubloc
+ SET hubloc_id_url = CONCAT(hubloc_url, '/channel/', SUBSTRING(hubloc_addr FROM 1 FOR POSITION('@' IN hubloc_addr) -1))
+ WHERE hubloc_network = 'zot'
+ AND hubloc_id_url = ''"
+ );
+
+ // fix singleton networks hubloc_id_url
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
+ LEFT JOIN xchan ON hubloc_hash = xchan_hash
+ SET hubloc_id_url = xchan_url
+ WHERE hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
+ AND hubloc_id_url = ''"
+ );
+
+ }
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
+ SET hubloc_id_url = xchan_url
+ FROM xchan
+ WHERE hubloc_hash = xchan_hash
+ AND hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
+ AND hubloc_id_url = ''"
+ );
+
+
+ }
+ }
+}
diff --git a/Zotlabs/Update/_1238.php b/Zotlabs/Update/_1238.php
index 77a14c3fa..32c21f161 100644
--- a/Zotlabs/Update/_1238.php
+++ b/Zotlabs/Update/_1238.php
@@ -21,26 +21,40 @@ class _1238 {
// fix singleton networks hubloc_id_url
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
LEFT JOIN xchan ON hubloc_hash = xchan_hash
SET hubloc_id_url = xchan_url
WHERE hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
- AND hubloc_id_url = ''
- AND xchan_url != ''"
+ AND hubloc_id_url = ''"
);
}
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
SET hubloc_id_url = xchan_url
FROM xchan
WHERE hubloc_hash = xchan_hash
AND hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
- AND hubloc_id_url = ''
- AND xchan_url != ''"
+ AND hubloc_id_url = ''"
);
}
- if($r1 && $r2) {
+ if($r1 && $r2 && $r3) {
q("COMMIT");
return UPDATE_SUCCESS;
}