From 3ff96239f6d45dc38600f18065d8778027131dde Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 6 Sep 2018 17:00:42 -0700 Subject: [PATCH 1/3] typo --- Zotlabs/Lib/Activity.php | 6 +++--- boot.php | 1 + include/text.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index c6bf926e0..424a9a4db 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1063,9 +1063,9 @@ class Activity { 'xchan_name_date' => datetime_convert(), 'xchan_network' => 'activitypub', 'xchan_photo_date' => datetime_convert('UTC','UTC','1968-01-01'), - 'xchan_photo_l' => z_rooot() . '/' . get_default_profile_photo(), - 'xchan_photo_m' => z_rooot() . '/' . get_default_profile_photo(80), - 'xchan_photo_s' => z_rooot() . '/' . get_default_profile_photo(48), + 'xchan_photo_l' => z_root() . '/' . get_default_profile_photo(), + 'xchan_photo_m' => z_root() . '/' . get_default_profile_photo(80), + 'xchan_photo_s' => z_root() . '/' . get_default_profile_photo(48), 'xchan_photo_mimetype' => 'image/png', ] diff --git a/boot.php b/boot.php index 25c6d5ad7..e3e1eb24c 100755 --- a/boot.php +++ b/boot.php @@ -407,6 +407,7 @@ define ( 'TERM_BOOKMARK', 8 ); define ( 'TERM_HIERARCHY', 9 ); define ( 'TERM_COMMUNITYTAG', 10 ); define ( 'TERM_FORUM', 11 ); +define ( 'TERM_EMOJI', 12 ); define ( 'TERM_OBJ_POST', 1 ); define ( 'TERM_OBJ_PHOTO', 2 ); diff --git a/include/text.php b/include/text.php index 6a463dec4..6c99e8411 100644 --- a/include/text.php +++ b/include/text.php @@ -6,7 +6,7 @@ use Zotlabs\Lib\MarkdownSoap; use Zotlabs\Lib\Group; use Zotlabs\Lib\Libzot; -use App; + use Michelf\MarkdownExtra; use Ramsey\Uuid\Uuid; From b77eac2ae8af232d84381fe050a25af8027ae2cd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 6 Sep 2018 17:36:35 -0700 Subject: [PATCH 2/3] move xchan_photo processing to background --- Zotlabs/Lib/Activity.php | 51 +++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 424a9a4db..f1989c39b 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2,10 +2,9 @@ namespace Zotlabs\Lib; -use Zotlabs\Lib\Libzot; -use Zotlabs\Lib\Libsync; -use Zotlabs\Lib\ActivityStreams; -use Zotlabs\Lib\Group; +use Zotlabs\Access\Permissions; +use Zotlabs\Access\PermissionRoles; +use Zotlabs\Daemon\Master; class Activity { @@ -801,9 +800,9 @@ class Activity { } } - $x = \Zotlabs\Access\PermissionRoles::role_perms('social'); - $p = \Zotlabs\Access\Permissions::FilledPerms($x['perms_connect']); - $their_perms = \Zotlabs\Access\Permissions::serialise($p); + $x = PermissionRoles::role_perms('social'); + $p = Permissions::FilledPerms($x['perms_connect']); + $their_perms = Permissions::serialise($p); if($contact && $contact['abook_id']) { @@ -823,7 +822,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': @@ -877,8 +876,8 @@ class Activity { } $ret = $r[0]; - $p = \Zotlabs\Access\Permissions::connect_perms($channel['channel_id']); - $my_perms = \Zotlabs\Access\Permissions::serialise($p['perms']); + $p = Permissions::connect_perms($channel['channel_id']); + $my_perms = Permissions::serialise($p['perms']); $automatic = $p['automatic']; $closeness = get_pconfig($channel['channel_id'],'system','new_abook_closeness',80); @@ -913,7 +912,7 @@ class Activity { dbesc($ret['xchan_hash']) ); if($new_connection) { - \Zotlabs\Lib\Enotify::submit( + Enotify::submit( [ 'type' => NOTIFY_INTRO, 'from_xchan' => $ret['xchan_hash'], @@ -924,9 +923,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(); @@ -1124,15 +1123,7 @@ class Activity { if(! $icon) $icon = z_root() . '/' . get_default_profile_photo(300); - $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'])), - dbesc($photos[0]), - dbesc($photos[1]), - dbesc($photos[2]), - dbesc($photos[3]), - dbesc($url) - ); + Master::Summon( [ 'Xchan_photo', bin2hex($icon), bin2hex($url) ] ); } @@ -1274,7 +1265,7 @@ class Activity { } if($channel['channel_system']) { - if(! \Zotlabs\Lib\MessageFilter::evaluate($s,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { + if(! MessageFilter::evaluate($s,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { logger('post is filtered'); return; } @@ -1370,7 +1361,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']) @@ -1551,7 +1542,7 @@ class Activity { $item['uid'] = $channel['channel_id']; if($channel['channel_system']) { - if(! \Zotlabs\Lib\MessageFilter::evaluate($item,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { + if(! MessageFilter::evaluate($item,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { logger('post is filtered'); return; } @@ -1596,7 +1587,7 @@ class Activity { if($parent) { if($item['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']) @@ -1661,7 +1652,7 @@ class Activity { $s['app'] = t('ActivityPub'); if($channel['channel_system']) { - if(! \Zotlabs\Lib\MessageFilter::evaluate($s,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { + if(! MessageFilter::evaluate($s,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) { logger('post is filtered'); return; } @@ -1742,7 +1733,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']) @@ -1878,8 +1869,8 @@ 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'])); - sync_an_item($channel['channel_id'],$result['item_id']); + Master::Summon(array('Notifier','comment-import',$result['item_id'])); + sync_an_item($channel['channel_id'],$result['item_id']); } return; From 551e7b332a8605d8dfe2d122c4af9c168fcace16 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 6 Sep 2018 17:37:09 -0700 Subject: [PATCH 3/3] move xchan_photo import to background --- Zotlabs/Daemon/Xchan_photo.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Zotlabs/Daemon/Xchan_photo.php diff --git a/Zotlabs/Daemon/Xchan_photo.php b/Zotlabs/Daemon/Xchan_photo.php new file mode 100644 index 000000000..85e9d674d --- /dev/null +++ b/Zotlabs/Daemon/Xchan_photo.php @@ -0,0 +1,28 @@ +