aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Activity.php111
-rw-r--r--Zotlabs/Lib/ActivityStreams.php5
-rw-r--r--Zotlabs/Lib/Api_router.php10
-rw-r--r--Zotlabs/Lib/Apps.php7
-rw-r--r--Zotlabs/Lib/DB_Upgrade.php9
-rw-r--r--Zotlabs/Lib/DReport.php2
-rw-r--r--Zotlabs/Lib/Enotify.php24
-rw-r--r--Zotlabs/Lib/Libsync.php2
-rw-r--r--Zotlabs/Lib/Libzot.php102
-rw-r--r--Zotlabs/Lib/Libzotdir.php4
-rw-r--r--Zotlabs/Lib/MessageFilter.php16
-rw-r--r--Zotlabs/Lib/ThreadItem.php26
-rw-r--r--Zotlabs/Lib/ZotURL.php2
13 files changed, 219 insertions, 101 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 9aaf6d866..232d845c7 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Daemon\Master;
use Zotlabs\Zot6\HTTPSig;
class Activity {
@@ -13,27 +14,30 @@ class Activity {
$x = json_decode($x,true);
}
- if(is_array($x) && array_key_exists('asld',$x)) {
- $x = $x['asld'];
- }
+ if(is_array($x)) {
- if($x['type'] === ACTIVITY_OBJ_PERSON) {
- return self::fetch_person($x);
- }
- if($x['type'] === ACTIVITY_OBJ_PROFILE) {
- return self::fetch_profile($x);
- }
- if(in_array($x['type'], [ ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_ARTICLE ] )) {
- return self::fetch_item($x);
- }
- if($x['type'] === ACTIVITY_OBJ_THING) {
- return self::fetch_thing($x);
- }
- if($x['type'] === ACTIVITY_OBJ_EVENT) {
- return self::fetch_event($x);
- }
- if($x['type'] === ACTIVITY_OBJ_PHOTO) {
- return self::fetch_image($x);
+ if(array_key_exists('asld',$x)) {
+ return $x['asld'];
+ }
+
+ if($x['type'] === ACTIVITY_OBJ_PERSON) {
+ return self::fetch_person($x);
+ }
+ if($x['type'] === ACTIVITY_OBJ_PROFILE) {
+ return self::fetch_profile($x);
+ }
+ if(in_array($x['type'], [ ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_ARTICLE ] )) {
+ return self::fetch_item($x);
+ }
+ if($x['type'] === ACTIVITY_OBJ_THING) {
+ return self::fetch_thing($x);
+ }
+ if($x['type'] === ACTIVITY_OBJ_EVENT) {
+ return self::fetch_event($x);
+ }
+ if($x['type'] === ACTIVITY_OBJ_PHOTO) {
+ return self::fetch_image($x);
+ }
}
return $x;
@@ -150,7 +154,7 @@ class Activity {
'type' => 'Image',
'id' => $x['id'],
'name' => $x['title'],
- 'content' => bbcode($x['body']),
+ 'content' => bbcode($x['body'], [ 'cache' => true ]),
'source' => [ 'mediaType' => 'text/bbcode', 'content' => $x['body'] ],
'published' => datetime_convert('UTC','UTC',$x['created'],ATOM_TIME),
'updated' => datetime_convert('UTC','UTC', $x['edited'],ATOM_TIME),
@@ -180,14 +184,24 @@ class Activity {
$y = [
'type' => 'Event',
'id' => z_root() . '/event/' . $ev['event_hash'],
- 'summary' => bbcode($ev['summary']),
+ 'summary' => bbcode($ev['summary'], [ 'cache' => true ]),
// RFC3339 Section 4.3
'startTime' => (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')),
- 'content' => bbcode($ev['description']),
- 'location' => [ 'type' => 'Place', 'content' => bbcode($ev['location']) ],
+ 'content' => bbcode($ev['description'], [ 'cache' => true ]),
+ 'location' => [ 'type' => 'Place', 'content' => bbcode($ev['location'], [ 'cache' => true ]) ],
'source' => [ 'content' => format_event_bbcode($ev), 'mediaType' => 'text/bbcode' ],
'actor' => $actor,
];
+ if(! $ev['nofinish']) {
+ $y['endTime'] = (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtend'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtend'],'Y-m-d\\TH:i:s-00:00'));
+ }
+
+ // copy attachments from the passed object - these are already formatted for ActivityStreams
+
+ if($x['attachment']) {
+ $y['attachment'] = $x['attachment'];
+ }
+
if($actor) {
return $y;
}
@@ -296,15 +310,15 @@ class Activity {
$ret['attributedTo'] = $i['author']['xchan_url'];
if($i['id'] != $i['parent']) {
- $ret['inReplyTo'] = ((strpos($i['parent_mid'],'http') === 0) ? $i['parent_mid'] : z_root() . '/item/' . urlencode($i['parent_mid']));
+ $ret['inReplyTo'] = ((strpos($i['thr_parent'],'http') === 0) ? $i['thr_parent'] : z_root() . '/item/' . urlencode($i['thr_parent']));
}
if($i['mimetype'] === 'text/bbcode') {
if($i['title'])
- $ret['name'] = bbcode($i['title']);
+ $ret['name'] = bbcode($i['title'], [ 'cache' => true ]);
if($i['summary'])
- $ret['summary'] = bbcode($i['summary']);
- $ret['content'] = bbcode($i['body']);
+ $ret['summary'] = bbcode($i['summary'], [ 'cache' => true ]);
+ $ret['content'] = bbcode($i['body'], [ 'cache' => true ]);
$ret['source'] = [ 'content' => $i['body'], 'mediaType' => 'text/bbcode' ];
}
@@ -397,7 +411,7 @@ class Activity {
$ret = [];
if($item['attach']) {
- $atts = json_decode($item['attach'],true);
+ $atts = ((is_array($item['attach'])) ? $item['attach'] : json_decode($item['attach'],true));
if($atts) {
foreach($atts as $att) {
if(strpos($att['type'],'image')) {
@@ -409,7 +423,7 @@ class Activity {
}
}
}
-
+
return $ret;
}
@@ -462,14 +476,14 @@ class Activity {
$ret['id'] = ((strpos($i['mid'],'http') === 0) ? $i['mid'] : z_root() . '/activity/' . urlencode($i['mid']));
if($i['title'])
- $ret['name'] = html2plain(bbcode($i['title']));
+ $ret['name'] = html2plain(bbcode($i['title'], [ 'cache' => true ]));
if($i['summary'])
- $ret['summary'] = bbcode($i['summary']);
+ $ret['summary'] = bbcode($i['summary'], [ 'cache' => true ]);
if($ret['type'] === 'Announce') {
$tmp = preg_replace('/\[share(.*?)\[\/share\]/ism',EMPTY_STR, $i['body']);
- $ret['content'] = bbcode($tmp);
+ $ret['content'] = bbcode($tmp, [ 'cache' => true ]);
$ret['source'] = [
'content' => $i['body'],
'mediaType' => 'text/bbcode'
@@ -495,7 +509,7 @@ class Activity {
}
if($i['id'] != $i['parent']) {
- $ret['inReplyTo'] = ((strpos($i['parent_mid'],'http') === 0) ? $i['parent_mid'] : z_root() . '/item/' . urlencode($i['parent_mid']));
+ $ret['inReplyTo'] = ((strpos($i['thr_parent'],'http') === 0) ? $i['thr_parent'] : z_root() . '/item/' . urlencode($i['thr_parent']));
$reply = true;
if($i['item_private']) {
@@ -526,6 +540,10 @@ class Activity {
else
return [];
+ if(strpos($i['body'],'[/share]') !== false) {
+ $i['obj'] = null;
+ }
+
if($i['obj']) {
if(! is_array($i['obj'])) {
$i['obj'] = json_decode($i['obj'],true);
@@ -548,6 +566,7 @@ class Activity {
return [];
}
+
if($i['target']) {
if(! is_array($i['target'])) {
$i['target'] = json_decode($i['target'],true);
@@ -692,7 +711,7 @@ class Activity {
// Reactions will just map to normal activities
if(strpos($verb,ACTIVITY_REACT) !== false)
- return 'Create';
+ return 'emojiReaction';
if(strpos($verb,ACTIVITY_MOOD) !== false)
return 'Create';
@@ -868,7 +887,7 @@ class Activity {
// Send an Accept back to them
set_abconfig($channel['channel_id'],$person_obj['id'],'pubcrawl','their_follow_id', $their_follow_id);
- \Zotlabs\Daemon\Master::Summon([ 'Notifier', 'permissions_accept', $contact['abook_id'] ]);
+ Master::Summon([ 'Notifier', 'permissions_accept', $contact['abook_id'] ]);
return;
case 'Accept':
@@ -969,9 +988,9 @@ class Activity {
if($my_perms && $automatic) {
// send an Accept for this Follow activity
- \Zotlabs\Daemon\Master::Summon([ 'Notifier', 'permissions_accept', $new_connection[0]['abook_id'] ]);
+ Master::Summon([ 'Notifier', 'permissions_accept', $new_connection[0]['abook_id'] ]);
// Send back a Follow notification to them
- \Zotlabs\Daemon\Master::Summon([ 'Notifier', 'permissions_create', $new_connection[0]['abook_id'] ]);
+ Master::Summon([ 'Notifier', 'permissions_create', $new_connection[0]['abook_id'] ]);
}
$clone = array();
@@ -1162,7 +1181,7 @@ class Activity {
$photos = import_xchan_photo($icon,$url);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
- dbescdate(datetime_convert('UTC','UTC',$arr['photo_updated'])),
+ dbescdate(datetime_convert('UTC','UTC',$photos[5])),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
@@ -1406,7 +1425,7 @@ class Activity {
if($parent) {
if($s['owner_xchan'] === $channel['channel_hash']) {
// We are the owner of this conversation, so send all received comments back downstream
- Zotlabs\Daemon\Master::Summon(array('Notifier','comment-import',$x['item_id']));
+ Master::Summon(array('Notifier','comment-import',$x['item_id']));
}
$r = q("select * from item where id = %d limit 1",
intval($x['item_id'])
@@ -1468,7 +1487,7 @@ class Activity {
}
- if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept' ])) {
+ if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept', 'emojiReaction' ])) {
$response_activity = true;
@@ -1509,6 +1528,9 @@ class Activity {
if($act->type === 'Announce') {
$content['content'] = sprintf( t('🔁 Repeated %1$s\'s %2$s'), $mention, $act->obj['type']);
}
+ if ($act->type === 'emojiReaction') {
+ $content['content'] = (($act->tgt && $act->tgt['type'] === 'Image') ? '[img=32x32]' . $act->tgt['url'] . '[/img]' : '&#x' . $act->tgt['name'] . ';');
+ }
}
if(! $s['created'])
@@ -1790,7 +1812,7 @@ class Activity {
$s['item_private'] = 1;
set_iconfig($s,'activitypub','recips',$act->raw_recips);
-
+ // @FIXME: $parent is not defined
if($parent) {
set_iconfig($s,'activitypub','rawmsg',$act->raw,1);
}
@@ -1921,10 +1943,11 @@ class Activity {
if(is_array($x) && $x['item_id']) {
+ // @FIXME: $parent is not defined
if($parent) {
if($s['owner_xchan'] === $channel['channel_hash']) {
// We are the owner of this conversation, so send all received comments back downstream
- Zotlabs\Daemon\Master::Summon(array('Notifier','comment-import',$x['item_id']));
+ Master::Summon(array('Notifier','comment-import',$x['item_id']));
}
$r = q("select * from item where id = %d limit 1",
intval($x['item_id'])
@@ -2060,7 +2083,7 @@ class Activity {
if($result['success']) {
// if the message isn't already being relayed, notify others
if(intval($parent_item['item_origin']))
- Zotlabs\Daemon\Master::Summon(array('Notifier','comment-import',$result['item_id']));
+ Master::Summon(array('Notifier','comment-import',$result['item_id']));
sync_an_item($channel['channel_id'],$result['item_id']);
}
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index a357b6d69..006744aff 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -319,7 +319,10 @@ class ActivityStreams {
function get_compound_property($property, $base = '', $namespace = '', $first = false) {
$x = $this->get_property_obj($property, $base, $namespace);
if($this->is_url($x)) {
- $x = $this->fetch_property($x);
+ $y = $this->fetch_property($x);
+ if (is_array($y)) {
+ $x = $y;
+ }
}
// verify and unpack JSalmon signature if present
diff --git a/Zotlabs/Lib/Api_router.php b/Zotlabs/Lib/Api_router.php
index 404678bd9..6e3f231a9 100644
--- a/Zotlabs/Lib/Api_router.php
+++ b/Zotlabs/Lib/Api_router.php
@@ -12,8 +12,16 @@ class Api_router {
}
static function find($path) {
- if(array_key_exists($path,self::$routes))
+ if (array_key_exists($path,self::$routes)) {
return self::$routes[$path];
+ }
+
+ $with_params = dirname($path) . '/[id]';
+
+ if (array_key_exists($with_params,self::$routes)) {
+ return self::$routes[$with_params];
+ }
+
return null;
}
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 56283ff76..69996b49d 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -70,7 +70,7 @@ class Apps {
'Channel Home',
'View Profile',
'Photos',
- 'Events',
+ 'Calendar',
'Directory',
'Search',
'Help',
@@ -327,6 +327,8 @@ class Apps {
'Report Bug' => t('Report Bug'),
'Bookmarks' => t('Bookmarks'),
'Chatrooms' => t('Chatrooms'),
+ 'Content Filter' => t('Content Filter'),
+ 'Content Import' => t('Content Import'),
'Connections' => t('Connections'),
'Remote Diagnostics' => t('Remote Diagnostics'),
'Suggest Channels' => t('Suggest Channels'),
@@ -340,7 +342,7 @@ class Apps {
'Channel Home' => t('Channel Home'),
'View Profile' => t('View Profile'),
'Photos' => t('Photos'),
- 'Events' => t('Events'),
+ 'Calendar' => t('Calendar'),
'Directory' => t('Directory'),
'Help' => t('Help'),
'Mail' => t('Mail'),
@@ -361,7 +363,6 @@ class Apps {
'Privacy Groups' => t('Privacy Groups'),
'Notifications' => t('Notifications'),
'Order Apps' => t('Order Apps'),
- 'CalDAV' => t('CalDAV'),
'CardDAV' => t('CardDAV'),
'Channel Sources' => t('Channel Sources'),
'Guest Access' => t('Guest Access'),
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php
index 4038a2d53..b6e3f7b7b 100644
--- a/Zotlabs/Lib/DB_Upgrade.php
+++ b/Zotlabs/Lib/DB_Upgrade.php
@@ -58,10 +58,15 @@ class DB_Upgrade {
$c = new $cls();
+
$retval = $c->run();
if($retval != UPDATE_SUCCESS) {
+
+ $source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Zotlabs/Update/' . $s . '.php');
+
+
// Prevent sending hundreds of thousands of emails by creating
// a lockfile.
@@ -86,7 +91,9 @@ class DB_Upgrade {
'$sitename' => \App::$config['system']['sitename'],
'$siteurl' => z_root(),
'$update' => $x,
- '$error' => sprintf( t('Update %s failed. See error logs.'), $x)
+ '$error' => sprintf( t('Update %s failed. See error logs.'), $x),
+ '$baseurl' => z_root(),
+ '$source' => $source
]
)
]
diff --git a/Zotlabs/Lib/DReport.php b/Zotlabs/Lib/DReport.php
index 18087e29f..7515d3292 100644
--- a/Zotlabs/Lib/DReport.php
+++ b/Zotlabs/Lib/DReport.php
@@ -118,7 +118,7 @@ class DReport {
// So if a remote site says they can't find us, that's no big surprise
// and just creates a lot of extra report noise
- if(($dr['location'] !== z_root()) && ($dr['sender'] === $rxchan) && ($dr['status'] === 'recipient_not_found'))
+ if(($dr['location'] !== z_root()) && ($dr['sender'] === $rxchan) && ($dr['status'] === 'recipient not found'))
return false;
// If you have a private post with a recipient list, every single site is going to report
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 5e5798cac..a7082f45a 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -754,9 +754,9 @@ class Enotify {
// generate a multipart/alternative message header
$messageHeader =
$params['additionalMailHeader'] .
- "From: $fromName <{$params['fromEmail']}>\n" .
- "Reply-To: $fromName <{$params['replyTo']}>\n" .
- "MIME-Version: 1.0\n" .
+ "From: $fromName <{$params['fromEmail']}>" . PHP_EOL .
+ "Reply-To: $fromName <{$params['replyTo']}>" . PHP_EOL .
+ "MIME-Version: 1.0" . PHP_EOL .
"Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
// assemble the final multipart message body with the text and html types included
@@ -764,15 +764,15 @@ class Enotify {
$htmlBody = chunk_split(base64_encode($params['htmlVersion']));
$multipartMessageBody =
- "--" . $mimeBoundary . "\n" . // plain text section
- "Content-Type: text/plain; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $textBody . "\n" .
- "--" . $mimeBoundary . "\n" . // text/html section
- "Content-Type: text/html; charset=UTF-8\n" .
- "Content-Transfer-Encoding: base64\n\n" .
- $htmlBody . "\n" .
- "--" . $mimeBoundary . "--\n"; // message ending
+ "--" . $mimeBoundary . PHP_EOL . // plain text section
+ "Content-Type: text/plain; charset=UTF-8" . PHP_EOL .
+ "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL .
+ $textBody . PHP_EOL .
+ "--" . $mimeBoundary . PHP_EOL . // text/html section
+ "Content-Type: text/html; charset=UTF-8" . PHP_EOL .
+ "Content-Transfer-Encoding: base64" . PHP_EOL . PHP_EOL .
+ $htmlBody . PHP_EOL .
+ "--" . $mimeBoundary . "--" . PHP_EOL; // message ending
// send the message
$res = mail(
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index d037a0058..d93270bc5 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -336,7 +336,7 @@ class Libsync {
$disallowed = array('abook_id','abook_account','abook_channel','abook_rating','abook_rating_text','abook_not_here');
- $fields = db_columns($abook);
+ $fields = db_columns('abook');
foreach($arr['abook'] as $abook) {
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 019237568..9bf987027 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -685,9 +685,27 @@ class Libzot {
$adult_changed = 1;
if(intval($r[0]['xchan_deleted']) != intval($arr['deleted']))
$deleted_changed = 1;
+
+ // new style 6-MAR-2019
+
+ if(array_key_exists('channel_type',$arr)) {
+ if($arr['channel_type'] === 'collection') {
+ // do nothing at this time.
+ }
+ elseif($arr['channel_type'] === 'group') {
+ $arr['public_forum'] = 1;
+ }
+ else {
+ $arr['public_forum'] = 0;
+ }
+ }
+
+ // old style
+
if(intval($r[0]['xchan_pubforum']) != intval($arr['public_forum']))
$pubforum_changed = 1;
+
if($arr['protocols']) {
$protocols = implode(',',$arr['protocols']);
if($protocols !== 'zot6') {
@@ -1107,9 +1125,14 @@ class Libzot {
logger('Activity rejected: ' . print_r($data,true));
return;
}
- $arr = Activity::decode_note($AS);
+ if (is_array($AS->obj)) {
+ $arr = Activity::decode_note($AS);
+ }
+ else {
+ $arr = [];
+ }
- logger($AS->debug());
+ logger($AS->debug(),LOGGER_DATA);
}
@@ -1174,12 +1197,14 @@ class Libzot {
//logger($AS->debug());
- $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' ",
dbesc($AS->actor['id'])
);
if($r) {
- $arr['author_xchan'] = $r[0]['hubloc_hash'];
+ // selects a zot6 hash if available, otherwise use whatever we have
+ $r = self::zot_record_preferred($r);
+ $arr['author_xchan'] = $r['hubloc_hash'];
}
@@ -1212,7 +1237,7 @@ class Libzot {
$relay = (($env['type'] === 'response') ? true : false );
- $result = self::process_delivery($env['sender'],$arr,$deliveries,$relay,false,$message_request);
+ $result = self::process_delivery($env['sender'],$AS,$arr,$deliveries,$relay,false,$message_request);
}
elseif($env['type'] === 'sync') {
// $arr = get_channelsync_elements($data);
@@ -1385,7 +1410,7 @@ class Libzot {
/**
* @brief
*
- * @param array $sender
+ * @param string $sender
* @param array $arr
* @param array $deliveries
* @param boolean $relay
@@ -1394,7 +1419,7 @@ class Libzot {
* @return array
*/
- static function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
+ static function process_delivery($sender, $act, $arr, $deliveries, $relay, $public = false, $request = false) {
$result = [];
@@ -1423,6 +1448,24 @@ class Libzot {
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
+ if(($act) && ($act->obj) && (! is_array($act->obj))) {
+ // The initial object fetch failed using the sys channel credentials.
+ // Try again using the delivery channel credentials.
+ // We will also need to re-parse the $item array,
+ // but preserve any values that were set during anonymous parsing.
+
+ $o = Activity::fetch($act->obj,$channel);
+ if($o) {
+ $act->obj = $o;
+ $arr = array_merge(Activity::decode_note($act),$arr);
+ }
+ else {
+ $DR->update('Incomplete or corrupt activity');
+ $result[] = $DR->get();
+ continue;
+ }
+ }
+
/**
* We need to block normal top-level message delivery from our clones, as the delivered
* message doesn't have ACL information in it as the cloned copy does. That copy
@@ -1841,7 +1884,7 @@ class Libzot {
logger('FOF Activity received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
logger('FOF Activity recipient: ' . $channel['channel_portable_id'], LOGGER_DATA, LOG_DEBUG);
- $result = self::process_delivery($arr['owner_xchan'],$arr, [ $channel['channel_portable_id'] ],false,false,true);
+ $result = self::process_delivery($arr['owner_xchan'],$AS, $arr, [ $channel['channel_portable_id'] ],false,false,true);
if ($result) {
$ret = array_merge($ret, $result);
}
@@ -1854,8 +1897,7 @@ class Libzot {
/**
* @brief Remove community tag.
*
- * @param array $sender an associative array with
- * * \e string \b hash a xchan_hash
+ * @param string $sender
* @param array $arr an associative array
* * \e int \b verb
* * \e int \b obj_type
@@ -1928,7 +1970,7 @@ class Libzot {
*
* @see item_store_update()
*
- * @param array $sender
+ * @param string $sender
* @param array $item
* @param array $orig
* @param int $uid
@@ -1979,7 +2021,7 @@ class Libzot {
/**
* @brief Deletes an imported item.
*
- * @param array $sender
+ * @param string $sender
* * \e string \b hash a xchan_hash
* @param array $item
* @param int $uid
@@ -1997,9 +2039,9 @@ class Libzot {
$r = q("select id, author_xchan, owner_xchan, source_xchan, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
and mid = '%s' and uid = %d limit 1",
- dbesc($sender['hash']),
- dbesc($sender['hash']),
- dbesc($sender['hash']),
+ dbesc($sender),
+ dbesc($sender),
+ dbesc($sender),
dbesc($item['mid']),
intval($uid)
);
@@ -2154,8 +2196,7 @@ class Libzot {
*
* @see import_directory_profile()
*
- * @param array $sender an associative array
- * * \e string \b hash a xchan_hash
+ * @param string $sender
* @param array $arr
* @param array $deliveries (unused)
* @return void
@@ -2165,7 +2206,7 @@ class Libzot {
logger('process_profile_delivery', LOGGER_DEBUG);
$r = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1",
- dbesc($sender['hash'])
+ dbesc($sender)
);
if($r) {
Libzotdir::import_directory_profile($sender, $arr, $r[0]['xchan_addr'], UPDATE_FLAGS_UPDATED, 0);
@@ -2176,8 +2217,7 @@ class Libzot {
/**
* @brief
*
- * @param array $sender an associative array
- * * \e string \b hash a xchan_hash
+ * @param string $sender
* @param array $arr
* @param array $deliveries (unused) deliveries is irrelevant
* @return void
@@ -3058,4 +3098,26 @@ class Libzot {
return(($x) ? true : false);
}
+
+ static public function zot_record_preferred($arr, $check = 'hubloc_network') {
+
+ if(! $arr) {
+ return $arr;
+ }
+
+ foreach($arr as $v) {
+ if($v[$check] === 'zot6') {
+ return $v;
+ }
+ }
+ foreach($arr as $v) {
+ if($v[$check] === 'zot') {
+ return $v;
+ }
+ }
+
+ return $arr[0];
+
+ }
+
}
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php
index 91d089c86..1cb52275c 100644
--- a/Zotlabs/Lib/Libzotdir.php
+++ b/Zotlabs/Lib/Libzotdir.php
@@ -307,7 +307,7 @@ class Libzotdir {
if ($ud['ud_addr'] && (! ($ud['ud_flags'] & UPDATE_FLAGS_DELETED))) {
$success = false;
- $href = \Zotlabs\Lib\Webfinger::zot_url(punify($url));
+ $href = \Zotlabs\Lib\Webfinger::zot_url(punify($ud['ud_addr']));
if($href) {
$zf = \Zotlabs\Lib\Zotfinger::exec($href);
}
@@ -651,4 +651,4 @@ class Libzotdir {
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Lib/MessageFilter.php b/Zotlabs/Lib/MessageFilter.php
index eb0fc3d2c..750d6d424 100644
--- a/Zotlabs/Lib/MessageFilter.php
+++ b/Zotlabs/Lib/MessageFilter.php
@@ -19,7 +19,7 @@ class MessageFilter {
$lang = null;
- if((strpos($incl,'lang=') !== false) || (strpos($excl,'lang=') !== false)) {
+ if((strpos($incl,'lang=') !== false) || (strpos($excl,'lang=') !== false) || (strpos($incl,'lang!=') !== false) || (strpos($excl,'lang!=') !== false)) {
$lang = detect_language($text);
}
@@ -39,10 +39,17 @@ class MessageFilter {
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return false;
}
+ elseif(substr($word,0,1) === '$' && $tags) {
+ foreach($tags as $t)
+ if(($t['ttype'] == TERM_CATEGORY) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ return false;
+ }
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return false;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return false;
+ elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
+ return false;
elseif(stristr($text,$word) !== false)
return false;
}
@@ -60,10 +67,17 @@ class MessageFilter {
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
+ elseif(substr($word,0,1) === '$' && $tags) {
+ foreach($tags as $t)
+ if(($t['ttype'] == TERM_CATEGORY) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ return true;
+ }
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return true;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return true;
+ elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
+ return true;
elseif(stristr($text,$word) !== false)
return true;
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 40c0fca4b..9161aa182 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -38,6 +38,7 @@ class ThreadItem {
$this->data = $data;
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
+ $this->threaded = get_config('system','thread_allow');
$observer = \App::get_observer();
@@ -305,6 +306,7 @@ class ThreadItem {
if($this->is_commentable() && $observer) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
+ $reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to"));
}
if ($shareable) {
@@ -331,7 +333,6 @@ class ThreadItem {
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$is_new = true;
-
localize_item($item);
$body = prepare_body($item,true);
@@ -347,10 +348,6 @@ class ThreadItem {
$comment_count_txt = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
$list_unseen_txt = (($unseen_comments) ? sprintf('%d unseen',$unseen_comments) : '');
-
-
-
-
$children = $this->get_children();
$has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false);
@@ -373,13 +370,15 @@ class ThreadItem {
'text' => strip_tags($body['html']),
'id' => $this->get_id(),
'mid' => $item['mid'],
+ 'parent' => $item['parent'],
+ 'author_id' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'isevent' => $isevent,
'attend' => $attend,
'consensus' => $consensus,
'conlabels' => $conlabels,
'canvote' => $canvote,
- 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']),
- 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']),
+ 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url'])),
+ 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), (($item['owner']['xchan_addr']) ? $item['owner']['xchan_addr'] : $item['owner']['xchan_url'])),
'llink' => $item['llink'],
'viewthread' => $viewthread,
'to' => t('to'),
@@ -425,9 +424,11 @@ class ThreadItem {
'has_tags' => $has_tags,
'reactions' => $this->reactions,
// Item toolbar buttons
- 'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
+ 'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
'like' => $like,
'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''),
+ 'reply_to' => (((! $this->is_toplevel()) && feature_enabled($conv->get_profile_owner(),'reply_to')) ? $reply_to : ''),
+ 'top_hint' => t("Go to previous comment"),
'share' => $share,
'embed' => $embed,
'rawmid' => $item['mid'],
@@ -440,9 +441,8 @@ class ThreadItem {
'addtocal' => (($has_event) ? t('Add to Calendar') : ''),
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
- 'dropdown_extras' => $dropdown_extras,
+ 'dropdown_extras' => $dropdown_extras,
// end toolbar buttons
-
'unseen_comments' => $unseen_comments,
'comment_count' => $total_children,
'comment_count_txt' => $comment_count_txt,
@@ -469,7 +469,8 @@ class ThreadItem {
'wait' => t('Please wait'),
'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])),
'thread_level' => $thread_level,
- 'settings' => $settings
+ 'settings' => $settings,
+ 'thr_parent' => (($item['parent_mid'] != $item['thr_parent']) ? $item['thr_parent'] : '')
);
$arr = array('item' => $item, 'output' => $tmp_item);
@@ -814,7 +815,7 @@ class ThreadItem {
'$anonname' => [ 'anonname', t('Your full name (required)') ],
'$anonmail' => [ 'anonmail', t('Your email address (required)') ],
'$anonurl' => [ 'anonurl', t('Your website URL (optional)') ],
- '$auto_save_draft' => $feature_auto_save_draft,
+ '$auto_save_draft' => $feature_auto_save_draft
));
return $comment_box;
@@ -869,4 +870,3 @@ class ThreadItem {
}
-
diff --git a/Zotlabs/Lib/ZotURL.php b/Zotlabs/Lib/ZotURL.php
index d1c705fcb..bc14c516a 100644
--- a/Zotlabs/Lib/ZotURL.php
+++ b/Zotlabs/Lib/ZotURL.php
@@ -66,7 +66,7 @@ class ZotURL {
}
- static public function is_zoturl($s) {
+ static public function is_zoturl($url) {
if(strpos($url,'x-zot:') === 0) {
return true;