From 836cb16455095d4fb34d73c86174b061203485f9 Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Tue, 13 Jun 2017 21:08:21 +0200 Subject: Added Portfolio widget --- Zotlabs/Widget/Portfolio.php | 108 +++++++++++++++++++++++++++++++++++++ view/tpl/photo_album_portfolio.tpl | 11 ++++ view/tpl/photo_portfolio.tpl | 13 +++++ 3 files changed, 132 insertions(+) create mode 100644 Zotlabs/Widget/Portfolio.php create mode 100755 view/tpl/photo_album_portfolio.tpl create mode 100755 view/tpl/photo_portfolio.tpl diff --git a/Zotlabs/Widget/Portfolio.php b/Zotlabs/Widget/Portfolio.php new file mode 100644 index 000000000..216ca952c --- /dev/null +++ b/Zotlabs/Widget/Portfolio.php @@ -0,0 +1,108 @@ + $rr['id'], + 'twist' => ' ' . $twist . rand(2,4), + 'link' => $imagelink, + 'title' => t('View Photo'), + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['imgscale'] . '.' .$ext, + 'fullsrc' => z_root() . '/photo/' . $rr['resource_id'] . '-' . '1' . '.' .$ext, + 'resource_id' => $rr['resource_id'], + 'alt' => $imgalt_e, + 'desc'=> $desc_e, + 'ext' => $ext, + 'hash'=> $rr['resource_id'], + 'unknown' => t('Unknown') + ); + } + } + + + $tpl = get_markup_template('photo_album_portfolio.tpl'); + $o .= replace_macros($tpl, array( + '$photos' => $photos, + '$album' => (($title) ? $title : $album), + '$album_id' => rand(), + '$album_edit' => array(t('Edit Album'), $album_edit), + '$can_post' => false, + '$upload' => array(t('Upload'), z_root() . '/photos/' . \App::$profile['channel_address'] . '/upload/' . bin2hex($album)), + '$order' => false, + '$upload_form' => $upload_form, + '$usage' => $usage_message + )); + + return $o; + } +} + diff --git a/view/tpl/photo_album_portfolio.tpl b/view/tpl/photo_album_portfolio.tpl new file mode 100755 index 000000000..7aadbc7e0 --- /dev/null +++ b/view/tpl/photo_album_portfolio.tpl @@ -0,0 +1,11 @@ +
+
+ {{foreach $photos as $photo}} + {{include file="photo_portfolio.tpl"}} + {{/foreach}} +
+
+
+ +
+
\ No newline at end of file diff --git a/view/tpl/photo_portfolio.tpl b/view/tpl/photo_portfolio.tpl new file mode 100755 index 000000000..cbc8ea214 --- /dev/null +++ b/view/tpl/photo_portfolio.tpl @@ -0,0 +1,13 @@ + + + + {{if $photo.album.name}}{{$photo.album.name}}{{elseif $photo.desc}}{{$photo.desc}}{{elseif $photo.alt}}{{$photo.alt}}{{else}}{{$photo.unknown}}{{/if}} + + + -- cgit v1.2.3 From d6dd2c5bd67fe314fec3d79e88625dbb20cded1e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 00:01:23 -0700 Subject: api docs 'categories' -> 'category' --- doc/developer/api_zot.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/developer/api_zot.bb b/doc/developer/api_zot.bb index ddca65b4d..a114c7c44 100644 --- a/doc/developer/api_zot.bb +++ b/doc/developer/api_zot.bb @@ -608,7 +608,7 @@ Optional: application or network name to display with item -- categories +- category comma separated categories for this item -- cgit v1.2.3 From 45137a55a468ed6b8e68e9d868c1fee18ac598e3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 10 Jun 2017 16:00:21 -0700 Subject: missed this hook page when the hook was added --- doc/hook/connection_remove.bb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/hook/connection_remove.bb diff --git a/doc/hook/connection_remove.bb b/doc/hook/connection_remove.bb new file mode 100644 index 000000000..bd13ae5f2 --- /dev/null +++ b/doc/hook/connection_remove.bb @@ -0,0 +1,9 @@ +[h3]connection_remove[/h3] + +Called when deleting a connection. + + +Passed parameter array: + + 'channel_id' => channel_id of the channel removing the connection + 'abook_id' => abook_id of the connection being removed -- cgit v1.2.3 From 2b9a8fa1ac6f0e086a64f114908fda69108d30cf Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 15:30:56 -0700 Subject: Add a section on connecting to other networks and activating additional protocols in the member guide - where it is needed the most. --- doc/member/member_guide.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 50f0b581b..f30860881 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -186,7 +186,15 @@ Visit their profile by clicking their photograph in the directory, matrix, or co You may also connect with any channel by visiting the "Connections" page of your site or the Directory and typing their "webbie" into the "Add New Connection" field. Use this method if somebody tells you their webbie and you wish to connect with them. A webbie looks like an email address; for example "bob@example.com". The process is the same as connecting via the "Connect" button - you will then be taken to the connection editor to set permissions. -[h4] Block/Ignore/Archive/Hide channels [/h4] +To connect with channels on other networks: + +The process for connecting to channels on other networks (such as GNU-Social, Mastodon, and Diaspora) is similar - type their "webbie" into the "Add New Connections" box on the "Connections" page. Before you do this however, please visit your Settings page (Feature/Addon Settings) and ensure that the relevant protocol (Diaspora or GNU-Social) is provided on your hub and [b][i]activated[/i] for your channel[/b]. These networks/protocols do not support account migration and location independence so if you move location or clone your channel elsewhere, communications with these connections may fail. For this reason these protocols are not activated by default, but only through your consent. Activating these protocols involves an important decision between communicating with friends on these networks or providing fail-safe account resilience if your server fails. + +To connect with RSS feeds: + +Your hub admin may allow connecting to RSS feeds. The process for connecting to an RSS feed is the same, exept type (or paste) the URL of the feed into the "Add New Connection" box. Feeds are only processed once or twice per day and your hub admin may impose limits on how many feeds you may add. + +[h4]Block/Ignore/Archive/Hide channels [/h4] Channels in your address book can have statuses such as [i]blocked[/i], [i]ignored[/i], [i]archived[/i] and [i]hidden[/i]. From your connections page you can see tabs that display the channels with those statuses. From your edit connection pages you can change the statuses of a channel. -- cgit v1.2.3 From bdf8940040e2236a1c08d9f154db631f5ada0ceb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 15:39:02 -0700 Subject: more stuff about connecting for the member guide --- doc/member/member_guide.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index f30860881..796c5e3bb 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -178,7 +178,9 @@ Connections in $Projectname can take on a great many different meanings. But let First, you need to find some channels to connect to. There are two primary ways of doing this. Firstly, setting the "Can send me their channel stream and posts" permission to "Anybody in this network" will bring posts from complete strangers to your matrix. This will give you a lot of public content and should hopefully help you find interesting, entertaing people, forums, and channels. -The next thing you can do is look at the Directory. The directory is available on every $Projectname website which means searching from your own site will bring in results from the entire network. You can search by name, interest, location and keyword. This is incomplete, so we'll improve this paragraph later. +The next thing you can do is look at the Directory. The directory is available on every $Projectname website which means searching from your own site will bring in results from the entire network. You can search by name, interest, location, and keyword. + +If you already know somebody's 'webbie' you can connect with them directly. A webbie looks just like an email address but refers to somebody in the open social web. In order to connect they must be using a compatible network protocol. By default, this software supports the 'zot' protocol, however additional protocols may be provided through plugins/addons. See below for more information on connecting to channels on other networks. To connect with other $Projectname channels: -- cgit v1.2.3 From 5854a226d79667638cbe26d11d19c8393541d56c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 15:41:00 -0700 Subject: typo --- doc/member/member_guide.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 796c5e3bb..fd35990c9 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -289,7 +289,7 @@ We highly recommend that you use the "typical social network" settings when you [i]Note:[/i] Plugins/addons may provide special permission settings, so you may be offered additional permission settings beyond what is described here. -If you have set any of these permissions to "only those I specifically allow", you may specify indivudal permissions on the connnection edit screen. +If you have set any of these permissions to "only those I specifically allow", you may specify individual permissions on the connnection edit screen. [h4]Affinity[/h4] -- cgit v1.2.3 From 02b0472058599863186f0dd16546be5436b00e4f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 18:40:29 -0700 Subject: remove some obsolete information from the member guide and expand on what a connection is at a basic level. --- doc/member/member_guide.bb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index fd35990c9..597e90631 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -174,19 +174,19 @@ You can also delegate control of your channels' posts and connections, but not i [h3]Connecting To Channels[/h3] -Connections in $Projectname can take on a great many different meanings. But let's keep it simple, you want to be friends with somebody like you are familiar with from social networking. How do you do it? +Connections in $Projectname can take on a great many different meanings. A connection is more accurately defined as a set of permissions that you have granted to somebody else. In traditional social network applications, all connections are granted the same permissions; or at most there two levels (friends and 'followers'). In $Projectname, a range of separate permissions may be set/adjusted depending on the siutation and relationship you have with the other channel. You can allow somebody to view your posts but not your photos. You can also deny them permission to comment on your posts or send private mail to you. But let's keep it simple, you want to be friends with somebody like you are familiar with from social networking. How do you do it? First, you need to find some channels to connect to. There are two primary ways of doing this. Firstly, setting the "Can send me their channel stream and posts" permission to "Anybody in this network" will bring posts from complete strangers to your matrix. This will give you a lot of public content and should hopefully help you find interesting, entertaing people, forums, and channels. The next thing you can do is look at the Directory. The directory is available on every $Projectname website which means searching from your own site will bring in results from the entire network. You can search by name, interest, location, and keyword. -If you already know somebody's 'webbie' you can connect with them directly. A webbie looks just like an email address but refers to somebody in the open social web. In order to connect they must be using a compatible network protocol. By default, this software supports the 'zot' protocol, however additional protocols may be provided through plugins/addons. See below for more information on connecting to channels on other networks. +If you already know somebody's 'webbie' you can connect with them directly. A webbie looks just like an email address (for instance bob@example.com) but refers to somebody in the open social web. In order to connect they must be using a compatible network protocol. By default, this software supports the 'zot' protocol, however additional protocols may be provided through plugins/addons. See below for more information on connecting to channels on other networks. To connect with other $Projectname channels: -Visit their profile by clicking their photograph in the directory, matrix, or comments, and it will open their channel home page in the channel viewer. At the left hand side of the screen, you will usually see a link called "connect". Click it, and you're done. Depending on the settings of the channel you are connecting to, you may need to wait for them to approve your connection, but no further action is needed on your part. Once you've initiated the connection, you will be taken to the connection editor. This allows you to assign specific permissions for this channel. If you don't allow any permissions, communication will be very limited. There are some quick links which you can use to avoid setting individual permissions. To provide a social network environment, "Full Sharing" is recommended. You may review the settings that are applied with the quick links to ensure they are suitable for the channel you are connecting with and adjust if necessary. Then scroll to the bottom of the page and click "Submit". +Visit their profile by clicking their photograph in the directory, matrix, or comments, and it will open their channel home page in the channel viewer. At the left hand side of the screen, you will usually see a link called "connect". Click it, and you're done. Depending on the settings of the channel you are connecting to, you may need to wait for them to approve your connection, but no further action is needed on your part. Once you've initiated the connection, you will be taken to the connection editor. This allows you to assign specific permissions for this channel if you wish to make any changes. -You may also connect with any channel by visiting the "Connections" page of your site or the Directory and typing their "webbie" into the "Add New Connection" field. Use this method if somebody tells you their webbie and you wish to connect with them. A webbie looks like an email address; for example "bob@example.com". The process is the same as connecting via the "Connect" button - you will then be taken to the connection editor to set permissions. +You may also connect with any channel by visiting the "Connections" page of your site or the Directory and typing their "webbie" into the "Add New Connection" field. Use this method if somebody tells you their webbie and you wish to connect with them. The process is the same as connecting via the "Connect" button - you will then be taken to the connection editor to set permissions. To connect with channels on other networks: -- cgit v1.2.3 From f1fd672d7b8e394eded0e9bf74d0c7dbf2bd6cf8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 18:44:55 -0700 Subject: another typo --- doc/member/member_guide.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 597e90631..5676cea24 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -358,7 +358,7 @@ Topical tags are indicated by preceding the tag name with the # character. This Topical tags are also not linked if they are purely numeric, e.g. #1. If you wish to use a numeric hashtag, please add some descriptive text such as #2012-elections. [h4]Bookmarks[/h4] -Bookmarks indicate a link which can be saved to your bookmark folder. They use the sequence #^ followed by the link. Often these are generatd automatically. If the 'bookmarker' addon is installed, this sequence will be converted to a bookmark icon when viewing the post or comment online and clicking the icon will save the bookmark. If the bookmarker addon is not installed, the post 'dropdown menu' contains a link for saving the bookmark or bookmarks. +Bookmarks indicate a link which can be saved to your bookmark folder. They use the sequence #^ followed by the link. Often these are generated automatically. If the 'bookmarker' addon is installed, this sequence will be converted to a bookmark icon when viewing the post or comment online and clicking the icon will save the bookmark. If the bookmarker addon is not installed, the post 'dropdown menu' contains a link for saving the bookmark or bookmarks. [h4]Spaces in Tags and Mentions[/h4] Where possible please use the auto-complete window to select tag and mention recipients, because it will generate a coded tag which uniquely identifies one channel. Names are sometimes ambiguous. However, you can "manually" tag a channel by matching the channel name or address. -- cgit v1.2.3 From e84ed1cb9a19535935c9b98d57b1d7688493b190 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 18:48:21 -0700 Subject: more obsolete references in member guide --- doc/member/member_guide.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 5676cea24..3e5172c23 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -1005,7 +1005,7 @@ The saved search widget will provide autocompletion of channels (the results are [h4]Remove Channel[/h4] -Go to the bottom of your channel settings page or visit the URL: +Select the 'Remove Channel' link on your channel settings page or visit the URL: [baseurl]/removeme @@ -1017,7 +1017,7 @@ If you have identity clones on other hubs this only removes by default the chan [h4]Remove Account[/h4] -Go to the bottom of your account settings page or visit the URL: +Select 'Remove Account' from your account settings page or visit the URL: [baseurl]/removeaccount @@ -1026,3 +1026,4 @@ You will need to confirm your password and the account you are currently logged [hl][i][b]This is irreversible.[/b][/i][/hl] All your channels will be deleted. If you have identity clones on other hubs this only removes by default the channels instances which exists on this hub. + -- cgit v1.2.3 From 3e13568f916d22c8016c479cbc4beca2b455072e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 18:52:00 -0700 Subject: add numbers to the techlevel descriptions because that's what we will use to indicate a minimum level in documentation --- Zotlabs/Lib/Techlevels.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Lib/Techlevels.php b/Zotlabs/Lib/Techlevels.php index 6a8c36fb3..380901678 100644 --- a/Zotlabs/Lib/Techlevels.php +++ b/Zotlabs/Lib/Techlevels.php @@ -7,12 +7,12 @@ class Techlevels { static public function levels() { $techlevels = [ - '0' => t('Beginner/Basic'), - '1' => t('Novice - not skilled but willing to learn'), - '2' => t('Intermediate - somewhat comfortable'), - '3' => t('Advanced - very comfortable'), - '4' => t('Expert - I can write computer code'), - '5' => t('Wizard - I probably know more than you do') + '0' => t('0. Beginner/Basic'), + '1' => t('1. Novice - not skilled but willing to learn'), + '2' => t('2. Intermediate - somewhat comfortable'), + '3' => t('3. Advanced - very comfortable'), + '4' => t('4. Expert - I can write computer code'), + '5' => t('5. Wizard - I probably know more than you do') ]; return $techlevels; } -- cgit v1.2.3 From 36cfdd529b51997977340b0de0375af2025bd6d4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Jun 2017 23:28:55 -0700 Subject: doco for the channel basic export api call --- doc/developer/api_zot.bb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/developer/api_zot.bb b/doc/developer/api_zot.bb index a114c7c44..b2c19d7a1 100644 --- a/doc/developer/api_zot.bb +++ b/doc/developer/api_zot.bb @@ -4,7 +4,20 @@ The API endpoints detailed below are relative to [code]api/z/1.0[/code], meaning [h3]channel/export/basic[/h3] -Export channel data +Export basic channel data + +Options: + - sections + comma-separated list of data types to export + + - posts + if true, return default sections plus 3 months of posts + + If no sections are requested, the following sections are returned: + channel, connections, config, apps, chatrooms, events, webpages, mail, wikis + + Files and large collections of posts may run into memory limits; these must generally be + requested separately. [h3]channel/stream[/h3] -- cgit v1.2.3 From 7c363310428d8f76356eb1423554cc2de6ebd4a0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 12 Jun 2017 16:17:23 -0700 Subject: add 'can_comment_on_post' hook so we can better deal with the complications of Diaspora policy --- doc/hook/can_comment_on_post.bb | 13 +++++++++++++ doc/hooklist.bb | 3 +++ include/items.php | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 doc/hook/can_comment_on_post.bb diff --git a/doc/hook/can_comment_on_post.bb b/doc/hook/can_comment_on_post.bb new file mode 100644 index 000000000..2cfd3b2da --- /dev/null +++ b/doc/hook/can_comment_on_post.bb @@ -0,0 +1,13 @@ +[h3]can_comment_on_post[/h3] + +Called when deciding whether or not to display a comment box for a post. + + +Hook data (array): + observer_hash => xchan_hash of current observer + item => posted item + allowed => 'unset' + + +To over-ride the default behaviour, change allowed to true or false + diff --git a/doc/hooklist.bb b/doc/hooklist.bb index db606cbdc..a9ba73e97 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -82,6 +82,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/build_pagehead]build_pagehead[/zrl] Called when creating the HTML page header +[zrl=[baseurl]/help/hook/can_comment_on_post]can_comment_on_post[/zrl] + Called when deciding whether or not to present a comment box for a post + [zrl=[baseurl]/help/hook/change_channel]change_channel[/zrl] Called when logging in to a channel (either during login or afterward through the channel manager) diff --git a/include/items.php b/include/items.php index 206a97c42..fa61d71de 100755 --- a/include/items.php +++ b/include/items.php @@ -219,6 +219,11 @@ function can_comment_on_post($observer_xchan, $item) { // logger('can_comment_on_post: comment_policy: ' . $item['comment_policy'], LOGGER_DEBUG); + $x = [ 'observer_hash' => $observer_xchan, 'item' => $item, 'allowed' => 'unset' ]; + call_hooks('can_comment_on_post',$x); + if($x['allowed'] !== 'unset') + return $x['allowed']; + if(! $observer_xchan) return false; -- cgit v1.2.3 From 5d2035b729d2d0075addf19cbe29536fbff5914a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 12 Jun 2017 19:17:50 -0700 Subject: implement feed_get_reshare to extract shared post info from atom feed and convert to bbcode --- include/feedutils.php | 261 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 170 insertions(+), 91 deletions(-) diff --git a/include/feedutils.php b/include/feedutils.php index f1cee4194..23a065298 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -278,6 +278,23 @@ function get_atom_elements($feed, $item, &$author) { $base_url = ''; + $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'); + if($rawcreated) + $res['created'] = unxmlify($rawcreated[0]['data']); + + $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'); + if($rawedited) + $res['edited'] = unxmlify($rawedited[0]['data']); + + if((x($res,'edited')) && (! (x($res,'created')))) + $res['created'] = $res['edited']; + + if(! $res['created']) + $res['created'] = $item->get_date('c'); + + if(! $res['edited']) + $res['edited'] = $item->get_date('c'); + $rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb'); // select between supported verbs @@ -288,112 +305,85 @@ function get_atom_elements($feed, $item, &$author) { // translate OStatus unfollow to activity streams if it happened to get selected - if((x($res,'verb')) && ($res['verb'] === 'http://ostatus.org/schema/1.0/unfollow')) + if((x($res,'verb')) && ($res['verb'] === 'http://ostatus.org/schema/1.0/unfollow')) { $res['verb'] = ACTIVITY_UNFOLLOW; + } - if(array_key_exists('verb',$res) && $res['verb'] === ACTIVITY_SHARE) { - // For Mastodon shares ("boosts"), we need to parse the original author information - // from the activity:object -> author structure - $rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object'); - - if($rawobj) { - $rawauthor = $rawobj->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author'); - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']) { - $author['author_name'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']); - } + // look for a photo. We should check media size and find the best one, + // but for now let's just find any author photo + + $rawauthor = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri']) { - $author['author_link'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri']); + if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { + $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; + foreach($base as $link) { + if(!x($author, 'author_photo') || ! $author['author_photo']) { + if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') + $author['author_photo'] = unxmlify($link['attribs']['']['href']); } - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { - $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; - foreach($base as $link) { - if(!x($author, 'author_photo') || ! $author['author_photo']) { - if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') - $author['author_photo'] = unxmlify($link['attribs']['']['href']); - } + } + } + $rawactor = $item->get_item_tags(NAMESPACE_ACTIVITY, 'actor'); + + if($rawactor && activity_match($rawactor[0]['child'][NAMESPACE_ACTIVITY]['obj_type'][0]['data'], ACTIVITY_OBJ_PERSON)) { + $base = $rawactor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; + if($base && count($base)) { + foreach($base as $link) { + if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link'])) + $author['author_link'] = unxmlify($link['attribs']['']['href']); + if(!x($author, 'author_photo') || ! $author['author_photo']) { + if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') + $author['author_photo'] = unxmlify($link['attribs']['']['href']); } } } } - else { - // look for a photo. We should check media size and find the best one, - // but for now let's just find any author photo - $rawauthor = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author'); + // check for a yahoo media element (github etc.) + if(! $author['author_photo']) { + $rawmedia = $item->get_item_tags(NAMESPACE_YMEDIA,'thumbnail'); + if($rawmedia && $rawmedia[0]['attribs']['']['url']) { + $author['author_photo'] = strip_tags(unxmlify($rawmedia[0]['attribs']['']['url'])); + } + } + + + // No photo/profile-link on the item - look at the feed level + + if((! (x($author,'author_link'))) || (! (x($author,'author_photo')))) { + $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { - if(!x($author, 'author_photo') || ! $author['author_photo']) { + if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link'])) { + $author['author_link'] = unxmlify($link['attribs']['']['href']); + $author['author_is_feed'] = true; + } + if(! $author['author_photo']) { if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') $author['author_photo'] = unxmlify($link['attribs']['']['href']); } } } - $rawactor = $item->get_item_tags(NAMESPACE_ACTIVITY, 'actor'); + $rawactor = $feed->get_feed_tags(NAMESPACE_ACTIVITY, 'subject'); - if($rawactor && activity_match($rawactor[0]['child'][NAMESPACE_ACTIVITY]['obj_type'][0]['data'], ACTIVITY_OBJ_PERSON)) { + if($rawactor && activity_match($rawactor[0]['child'][NAMESPACE_ACTIVITY]['obj_type'][0]['data'],ACTIVITY_OBJ_PERSON)) { $base = $rawactor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; + if($base && count($base)) { foreach($base as $link) { if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link'])) $author['author_link'] = unxmlify($link['attribs']['']['href']); - if(!x($author, 'author_photo') || ! $author['author_photo']) { + if(! (x($author,'author_photo'))) { if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') $author['author_photo'] = unxmlify($link['attribs']['']['href']); } } } } - - // check for a yahoo media element (github etc.) - - if(! $author['author_photo']) { - $rawmedia = $item->get_item_tags(NAMESPACE_YMEDIA,'thumbnail'); - if($rawmedia && $rawmedia[0]['attribs']['']['url']) { - $author['author_photo'] = strip_tags(unxmlify($rawmedia[0]['attribs']['']['url'])); - } - } - - - // No photo/profile-link on the item - look at the feed level - - if((! (x($author,'author_link'))) || (! (x($author,'author_photo')))) { - $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { - $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; - foreach($base as $link) { - if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link'])) { - $author['author_link'] = unxmlify($link['attribs']['']['href']); - $author['author_is_feed'] = true; - } - if(! $author['author_photo']) { - if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') - $author['author_photo'] = unxmlify($link['attribs']['']['href']); - } - } - } - - $rawactor = $feed->get_feed_tags(NAMESPACE_ACTIVITY, 'subject'); - - if($rawactor && activity_match($rawactor[0]['child'][NAMESPACE_ACTIVITY]['obj_type'][0]['data'], ACTIVITY_OBJ_PERSON)) { - $base = $rawactor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; - - if($base && count($base)) { - foreach($base as $link) { - if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link'])) - $author['author_link'] = unxmlify($link['attribs']['']['href']); - if(! (x($author,'author_photo'))) { - if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') - $author['author_photo'] = unxmlify($link['attribs']['']['href']); - } - } - } - } - } } $ostatus_protocol = (($item->get_item_tags(NAMESPACE_OSTATUS, 'conversation')) ? true : false); @@ -499,23 +489,6 @@ function get_atom_elements($feed, $item, &$author) { if($rawlocation) $res['location'] = unxmlify($rawlocation[0]['data']); - $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'); - if($rawcreated) - $res['created'] = unxmlify($rawcreated[0]['data']); - - $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'); - if($rawedited) - $res['edited'] = unxmlify($rawedited[0]['data']); - - if((x($res,'edited')) && (! (x($res,'created')))) - $res['created'] = $res['edited']; - - if(! $res['created']) - $res['created'] = $item->get_date('c'); - - if(! $res['edited']) - $res['edited'] = $item->get_date('c'); - // Disallow time travelling posts @@ -597,6 +570,7 @@ function get_atom_elements($feed, $item, &$author) { $attach = $item->get_enclosures(); if($attach) { + $res['attach'] = array(); foreach($attach as $att) { $len = intval($att->get_length()); @@ -616,6 +590,7 @@ function get_atom_elements($feed, $item, &$author) { $res['attach'][] = array('href' => $link, 'length' => $len, 'type' => $type, 'title' => $title ); } } + $rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object'); @@ -693,6 +668,10 @@ function get_atom_elements($feed, $item, &$author) { $res['target'] = $obj; } + if(array_key_exists('verb',$res) && $res['verb'] === ACTIVITY_SHARE) { + feed_get_reshare($res,$item); + } + // build array to pass to hook $arr = [ 'feed' => $feed, @@ -709,6 +688,106 @@ function get_atom_elements($feed, $item, &$author) { return $arr['result']; } +function feed_get_reshare(&$res,$item) { + + $share = []; + + // For Mastodon shares ("boosts"), we need to parse the original author information + // from the activity:object -> author structure + $rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object'); + + if($rawobj) { + + $rawauthor = $rawobj->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author'); + + if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']) { + $share['author'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']); + } + + if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri']) { + $share['profile'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri']); + } + + if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { + $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; + foreach($base as $link) { + if(! (array_key_exists('avatar',$share) && $share['avatar'])) { + if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') + $share['avatar'] = unxmlify($link['attribs']['']['href']); + } + } + } + + if(! $share['author']) + $share['author'] = t('unknown'); + if(! $share['avatar']) + $share['avatar'] = z_root() . '/' . get_default_profile_photo(80); + if(! $share['profile']) + $share['profile'] = z_root(); + + $child = $rawobj[0]['child']; + + + if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']) + $share['link'] = encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']); + + $rawcreated = $rawobj->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'); + if($rawcreated) + $share['created'] = unxmlify($rawcreated[0]['data']); + else + $share['created'] = $res['created']; + + if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'id') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data']) + $share['message_id'] = unxmlify($child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data']); + + if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'content') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) { + $body = unxmlify($child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']); + if(! $body) + $body = unxmlify($child[SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']); + + if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) { + $body = purify_html($body); + $body = html2bbcode($body); + } + } + + $attach = $rawobj->get_enclosures(); + if($attach) { + foreach($attach as $att) { + $len = intval($att->get_length()); + $link = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_link())))); + $title = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_title())))); + $type = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_type())))); + if(strpos($type,';')) + $type = substr($type,0,strpos($type,';')); + if((! $link) || (strpos($link,'http') !== 0)) + continue; + + if(! $title) + $title = ' '; + if(! $type) + $type = 'application/octet-stream'; + + if((strpos($type,'image') === 0) && (strpos($body,$link) === false) && (strpos($link,'http') === 0)) { + $body .= "\n\n" . '[img]' . $link . '[/img]'; + } + } + } + + $res['body'] = "[share author='" . urlencode($share['author']) . + "' profile='" . $share['profile'] . + "' avatar='" . $share['avatar'] . + "' link='" . $share['link'] . + "' posted='" . $share['created'] . + "' message_id='" . $share['message_id'] . "']"; + $o .= $body; + $o .= "[/share]"; + } + +} + + + /** * @brief Encodes SimplePie_Item link arrays. * -- cgit v1.2.3 From 2f8fb2b663c9b1ea1879724d8542654263085b6d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 12 Jun 2017 21:12:14 -0700 Subject: ostatus is almost unrecognisable these days from its former self. In this case thr:in-reply-to has almost no meaning since it almost never refers to a top level post; which makes it quite difficult to preserve conversations --- include/feedutils.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/feedutils.php b/include/feedutils.php index 23a065298..22e2b5add 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -996,11 +996,23 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { dbesc($parent_mid), intval($importer['channel_id']) ); - if($x) - $parent_mid = $x[0]['mid']; - $datarray['parent_mid'] = $parent_mid; + if($x) { + $pmid = $x[0]['mid']; + $datarray['parent_mid'] = $pmid; + } + else { + // immediate parent wasn't found. Turn into a top-level post if permissions allow + // but save the thread_parent in case we need to refer to it later. We should probably + // also save the ostatus:conversation_id + + if(! post_is_importable($datarray, $contact)) + continue; + $datarray['parent_mid'] = $datarray['mid']; + set_iconfig($datarray,'system','parent_mid',$parent_mid,true); + } + $datarray['aid'] = $importer['channel_account_id']; $datarray['uid'] = $importer['channel_id']; -- cgit v1.2.3 From 5530833bf88342bc407375fb9c29b99b2c79e7bc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 12 Jun 2017 21:58:40 -0700 Subject: preserve the ostatus:conversation pointer also --- include/feedutils.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index 22e2b5add..317516c74 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -386,7 +386,14 @@ function get_atom_elements($feed, $item, &$author) { } } - $ostatus_protocol = (($item->get_item_tags(NAMESPACE_OSTATUS, 'conversation')) ? true : false); + $rawcnv = $item->get_item_tags(NAMESPACE_OSTATUS, 'conversation'); + if($rawcnv) { + $ostatus_conversation = unxmlify($rawcnv[0]['attribs']['']['ref']); + set_iconfig($res,'ostatus','conversation',$ostatus_conversation,true); + } + + $ostatus_protocol = (($ostatus_conversation) ? true : false); + $mastodon = (($item->get_item_tags('http://mastodon.social/schema/1.0','scope')) ? true : false); if($mastodon) $ostatus_protocol = true; -- cgit v1.2.3 From 8eccd7d47d300f569ddb06d85f1a38441610d61e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Jun 2017 18:06:45 -0700 Subject: attempt to group gnu-social and mastodon conversations by ostatus:conversation in addition to falling back on thr:in_reply_to --- include/feedutils.php | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/include/feedutils.php b/include/feedutils.php index 317516c74..156a78a39 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -999,20 +999,35 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { continue; } - $x = q("select mid from item where mid = '%s' and uid = %d limit 1", - dbesc($parent_mid), - intval($importer['channel_id']) - ); - - if($x) { - $pmid = $x[0]['mid']; - $datarray['parent_mid'] = $pmid; + $pmid = ''; + $conv_id = get_iconfig($datarray,'ostatus','conversation'); + + if($conv_id) { + $c = q("select parent_mid from item left join iconfig on item.id = iconfig.iid where iconfig.cat = 'ostatus' and iconfig.k = 'conversation' and iconfig.v = '%s' and item.uid = %d order by item.id limit 1", + dbesc($conv_id), + intval($importer['channel_id']) + ); + if($c) { + $pmid = $x[0]['parent_mid']; + $datarray['parent_mid'] = $pmid; + } } else { + $x = q("select mid from item where mid = '%s' and uid = %d limit 1", + dbesc($parent_mid), + intval($importer['channel_id']) + ); + + if($x) { + $pmid = $x[0]['mid']; + $datarray['parent_mid'] = $pmid; + } + } + + if(! $pmid) { // immediate parent wasn't found. Turn into a top-level post if permissions allow - // but save the thread_parent in case we need to refer to it later. We should probably - // also save the ostatus:conversation_id + // but save the thread_parent in case we need to refer to it later. if(! post_is_importable($datarray, $contact)) continue; -- cgit v1.2.3 From dcbc65a796facf17d2194f0c6a738f43bfe2cc40 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Jun 2017 18:29:08 -0700 Subject: add rel=noopener to all external target _blank links --- Zotlabs/Module/Oembed.php | 2 +- include/bbcode.php | 32 ++++++++++++++++---------------- include/text.php | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Zotlabs/Module/Oembed.php b/Zotlabs/Module/Oembed.php index 9394e5942..aee5ea079 100644 --- a/Zotlabs/Module/Oembed.php +++ b/Zotlabs/Module/Oembed.php @@ -22,7 +22,7 @@ class Oembed extends \Zotlabs\Web\Controller { } else { - echo ""; + echo ""; $src = base64url_decode(argv(1)); $j = oembed_fetch_url($src); echo $j['html']; diff --git a/include/bbcode.php b/include/bbcode.php index 0d2fb8c74..f0ec15130 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -839,7 +839,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) if($tryoembed) { $Text = preg_replace_callback("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ism", 'tryoembed', $Text); } - $Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ism", '$1$2', $Text); + $Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ism", '$1$2', $Text); } if (strpos($Text,'[/share]') !== false) { @@ -851,16 +851,16 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } } if (strpos($Text,'[/url]') !== false) { - $Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '#^$1', $Text); - $Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '#^$2', $Text); - $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text); - $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text); + $Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '#^$1', $Text); + $Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '#^$2', $Text); + $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text); + $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text); } if (strpos($Text,'[/zrl]') !== false) { - $Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '#^$1', $Text); - $Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '#^$2', $Text); - $Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '$1', $Text); - $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '$2', $Text); + $Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '#^$1', $Text); + $Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '#^$2', $Text); + $Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '$1', $Text); + $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '$2', $Text); } if (get_account_techlevel() < 2) @@ -868,8 +868,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) // Perform MAIL Search if (strpos($Text,'[/mail]') !== false) { - $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text); - $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '$2', $Text); + $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text); + $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '$2', $Text); } @@ -1189,17 +1189,17 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) // if video couldn't be embedded, link to it instead. if (strpos($Text,'[/video]') !== false) { - $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '$1', $Text); + $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '$1', $Text); } if (strpos($Text,'[/audio]') !== false) { - $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '$1', $Text); + $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '$1', $Text); } if (strpos($Text,'[/zvideo]') !== false) { - $Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '$1', $Text); + $Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '$1', $Text); } if (strpos($Text,'[/zaudio]') !== false) { - $Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '$1', $Text); + $Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '$1', $Text); } // if ($tryoembed){ @@ -1208,7 +1208,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) // } // } else { // if (strpos($Text,'[/iframe]') !== false) { -// $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '$1', $Text); +// $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '$1', $Text); // } // } diff --git a/include/text.php b/include/text.php index d8438b2b1..c633ba62a 100644 --- a/include/text.php +++ b/include/text.php @@ -1552,13 +1552,13 @@ function prepare_body(&$item,$attach = false) { // if original photo width is <= 640px prepend it to item body if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) { - $s .= '
' . $s; + $s .= '
' . $s; } // if original photo width is > 640px make it a cover photo if($object['link'][0]['width'] && $object['link'][0]['width'] > 640) { $scale = ((($object['link'][1]['width'] == 1024) || ($object['link'][1]['height'] == 1024)) ? 1 : 0); - $photo = ''; + $photo = ''; } } -- cgit v1.2.3 From ec1156d37a5d36136cc2b591248d65c5b826db2a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Jun 2017 19:24:42 -0700 Subject: more doco improvements --- doc/about/about_hubzilla.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/about/about_hubzilla.bb b/doc/about/about_hubzilla.bb index e9485ffa6..bf42446a7 100644 --- a/doc/about/about_hubzilla.bb +++ b/doc/about/about_hubzilla.bb @@ -115,7 +115,7 @@ Posts and messages may be created with an expiration date, at which time they wi [h4]Service Federation[/h4] -In addition to addon "cross-post connectors" to a variety of alternate networks, there is native support for importation of content from RSS/Atom feeds and using this to create special channels. Also, an experimental but working implementation of the Diaspora protocol allows communication with people on the Friendica and Diaspora decentralised social networks. This is currently marked experimental because these networks do not have the same level of privacy and encryption features and abilities as $Projectname and may present privacy risks. +In addition to addon "cross-post connectors" to a variety of alternate networks, there is native support for importation of content from RSS/Atom feeds and using this to create special channels. Plugins are also available to communicate with others using the Diaspora and GNU-Social (OStatus) protocols. These networks do not support nomadic identity or cross-domain access control; however basic communications are supported to/from Diaspora, Friendica, GNU-Social, Mastodon and other providers which use these protocols. There is also experimental support for OpenID authentication which may be used in Access Control Lists. This is a work in progress. Your $Projectname hub may be used as an OpenID provider to authenticate you to external services which use this technology. @@ -195,7 +195,7 @@ Any content created in $Projectname remains under the control of the member (or Similar to any other modern blogging system, social network, or a micro-blogging service, $Projectname supports the uploading of files, embedding of videos, linking web pages. [h4]Previewing/Editing[/h4] -Post can be previewed prior to sending and edited after sending. +Posts and comments can be previewed prior to sending and edited after sending. [h4]Voting/Consensus[/h4] Posts can be turned into "consensus" items which allows readers to offer feedback, which is collated into "agree", "disagree", and "abstain" counters. This lets you gauge interest for ideas and create informal surveys. @@ -206,4 +206,4 @@ $Projectname can be extended in a number of ways, through site customisation, pe [h4]API[/h4] -An API is available for use by third-party services. This is based originally on the early Twitter API (for which hundreds of third-party tools exist). It is currently being extended to provide access to facilities and abilities which are specific to $Projectname. Access may be provided by login/password or OAuth and client registration of OAuth applications is provided. +An API is available for use by third-party services. A plugin also provides a basic implementation of the Twitter API (for which hundreds of third-party tools exist). Access may be provided by login/password or OAuth, and client registration of OAuth applications is provided. -- cgit v1.2.3 From 70e912736f10bb8eaf8978689ae0183f7970043c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Jun 2017 19:52:16 -0700 Subject: support mastodon content warnings by converting into n-s-f-w tag --- include/feedutils.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/feedutils.php b/include/feedutils.php index 156a78a39..c9c7522b1 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -266,6 +266,8 @@ function get_atom_elements($feed, $item, &$author) { $res['item_rss'] = 1; + $summary = unxmlify($item->get_description(true)); + // removing the content of the title if its identically to the body // This helps with auto generated titles e.g. from tumblr @@ -486,6 +488,12 @@ function get_atom_elements($feed, $item, &$author) { ); } + // turn Mastodon content warning into a #nsfw hashtag + if($mastodon && $summary) { + $res['body'] .= "\n\n#nsfw\n"; + } + + $private = $item->get_item_tags(NAMESPACE_DFRN, 'private'); if($private && intval($private[0]['data']) > 0) $res['item_private'] = ((intval($private[0]['data'])) ? 1 : 0); -- cgit v1.2.3 From 54e07389fa1ebe7a2d2815258b021c07d2fc4dd0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 14 Jun 2017 22:14:52 +0200 Subject: thr:in-reply-to seems to must not have a type set. there is no mention of this in the spec and replies will be shown as replies in mastodon this way. --- include/feedutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index c9c7522b1..d1c7a5c64 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1505,7 +1505,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; } if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) { -- cgit v1.2.3 From 3f488e98421597749a7fc8af35e48d0b11f980ae Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 14 Jun 2017 22:53:09 +0200 Subject: fix illegal offset type warning --- include/connections.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/connections.php b/include/connections.php index 85b961b65..56457ea10 100644 --- a/include/connections.php +++ b/include/connections.php @@ -634,8 +634,8 @@ function get_vcard_array($vc,$id) { 'address' => $adr->getParts() ]; $last_entry = end($adrs); - if($adrs[$last_entry]['address']) - array_walk($adrs[$last_entry]['address'],'array_escape_tags'); + if($last_entry['address']) + array_walk($last_entry['address'],'array_escape_tags'); } } -- cgit v1.2.3 From ec74b5700024063ea8bd3fb8d644df881c704fb3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 14 Jun 2017 23:21:47 +0200 Subject: re-add type since the actual culprit was the X-ZOT prefix --- include/feedutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index d1c7a5c64..eb2d3a6e1 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1505,7 +1505,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; } if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) { -- cgit v1.2.3 From fe02665f54a2bd4746757348680a2cee439c2750 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 15 Jun 2017 00:17:26 +0200 Subject: typo --- include/feedutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index eb2d3a6e1..c9c7522b1 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1505,7 +1505,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; } if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) { -- cgit v1.2.3 From 1f075d92bc4e47ae282f811d10c31cd6f09191a6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 15 Jun 2017 00:19:50 +0200 Subject: sigh... x-zot prefix slipped in again --- include/feedutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index c9c7522b1..02decca69 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1505,7 +1505,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; } if(activity_match($item['obj_type'],ACTIVITY_OBJ_EVENT) && activity_match($item['verb'],ACTIVITY_POST)) { -- cgit v1.2.3