diff options
author | mrjive <mrjive@mrjive.it> | 2018-02-02 09:23:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-02 09:23:55 +0100 |
commit | d7ecaa8b23a36ea1e9a0f185017930b5552c00b5 (patch) | |
tree | bc3c6b600f7949ea3adf6854c0bf1690ae6e772e | |
parent | 7ac4b477020689572a50dbc777c968263e86f6c4 (diff) | |
parent | 512f3a764361dde44e36fb72c105265d6df298ad (diff) | |
download | volse-hubzilla-d7ecaa8b23a36ea1e9a0f185017930b5552c00b5.tar.gz volse-hubzilla-d7ecaa8b23a36ea1e9a0f185017930b5552c00b5.tar.bz2 volse-hubzilla-d7ecaa8b23a36ea1e9a0f185017930b5552c00b5.zip |
Merge pull request #14 from redmatrix/dev
Dev
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Connedit.php | 23 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 17 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | doc/member/member_guide.bb | 8 | ||||
-rw-r--r-- | include/feedutils.php | 57 | ||||
-rw-r--r-- | include/hubloc.php | 18 | ||||
-rw-r--r-- | include/text.php | 28 | ||||
-rwxr-xr-x | view/tpl/atom_feed.tpl | 2 | ||||
-rw-r--r-- | view/tpl/notifications_widget.tpl | 8 |
10 files changed, 104 insertions, 65 deletions
@@ -3,18 +3,18 @@ Hubzilla - Community Server =========================== + <p align="center" markdown="1"> <em><a href="https://github.com/redmatrix/hubzilla/blob/master/install/INSTALL.txt">Installing Hubzilla</a></em> </p> - **What is Hubzilla?** -Hubzilla is a general purpose communication server integrated with a web publishing system and a decentralised permission system. If this sounds like a bunch of technical mumbo-jumbo to you, just think of it as an independent platform for sharing stuff online. +Hubzilla is a general purpose communication server integrated with a web publishing system and a decentralised permission system. If this sounds like a bunch of technical mumbo-jumbo to you, just think of it as an independent platform for sharing stuff online (publicly or privately). Hubzilla contains some social network bits, some cloud storage bits, some blog and forum bits, and some content management bits. These are all integrated within a common privacy framework - and it is all decentralised. -Everything you publish or share can be restricted to those channels and people you wish to share them with; and these permissions work completely invisibly - even with channels on different servers or other communications services. +Everything you publish or share can be restricted to those channels and people you wish to share them with; and these permissions work completely invisibly - **even with channels on different servers or other communications services**. Migration and live backups of your connections, settings, and everything you publish are built-in, so you never need worry about server failure. diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 8288886cd..e23a751d9 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -826,27 +826,10 @@ class Connedit extends \Zotlabs\Web\Controller { } } - $locstr = ''; - - $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' - and hubloc_deleted = 0 and site_dead = 0", - dbesc($contact['xchan_hash']) - ); - - if($locs) { - foreach($locs as $l) { - if(!($l['location'])) - continue; - if(strpos($locstr,$l['location']) !== false) - continue; - if(strlen($locstr)) - $locstr .= ', '; - $locstr .= $l['location']; - } - } - else + $locstr = locations_by_netid($contact['xchan_hash']); + if(! $locstr) $locstr = $contact['xchan_url']; - + $clone_warn = ''; $clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false); if(! $clonable) { diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 6d895feb5..11dd0d174 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -343,14 +343,15 @@ class Display extends \Zotlabs\Web\Controller { case 'atom': $atom = replace_macros(get_markup_template('atom_feed.tpl'), array( - '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), - '$red' => xmlify(\Zotlabs\Lib\System::get_platform_name()), - '$feed_id' => xmlify(\App::$cmd), - '$feed_title' => xmlify(t('Article')), - '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), - '$author' => '', - '$owner' => '', - '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']), + '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), + '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()), + '$generator_uri' => 'https://hubzilla.org', + '$feed_id' => xmlify(\App::$cmd), + '$feed_title' => xmlify(t('Article')), + '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), + '$author' => '', + '$owner' => '', + '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']), )); $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ]; @@ -1014,7 +1014,7 @@ class App { self::$baseurl = $url; - if($parsed) { + if($parsed !== false) { self::$scheme = $parsed['scheme']; self::$hostname = $parsed['host']; diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 6286e74a3..10ea4db57 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -345,16 +345,18 @@ If the person mentioned is in the list of recipients for the post, they will rec [h4]Deliverable Mentions[/h4] -Some connections in the mention auto-complete box behave differently than others. If you mention a channel which provides "re-delivery of mentions" it will also send the post to all of that channel's default delivery connections. This is how one posts to "forums". The auto-complete box will provide two entries for these channels, one will mention just the channel. The other will invoke re-delivery and be listed as the channel's "network". +The [b]![/b] character designates a deliverable mention to a forum or special channel which allows "re-delivery of mentions". [code] @Gardening - mention the Gardening forum [/code] [code] -@Gardening+ - mention the Gardening Forum and also post to the Gardening "network" (e.g. all the forum members; if you have permission to do so) +!Gardening - mention the Gardening Forum and also post to the Gardening "network" (e.g. send to all the forum members; if you have permission to do so) [/code] +Note: In previous releases, forums were delivered by using @forum+ with a plus sign at the end. This mechanism is still used occasionally but is deprecated and !forum is now preferred. + [h4]Private Mentions[/h4] If you wish to restrict a post to a single person or a number of people, you can do this by selecting channels or privacy groups from the privacy tool. You can also just tag them with a privacy tag. A privacy tag is a name preceded by the two characters @! - and in addition to tagging these channels, will also change the privacy permissions of the post to only include them. You can have more than one privacy tag, for instance @!bob and @!linda will send the post only to Bob and Linda. This mechanism over-rides the privacy selector. @@ -369,7 +371,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 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. +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. diff --git a/include/feedutils.php b/include/feedutils.php index 5e48cb1ee..5ef45a6cd 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -15,15 +15,6 @@ */ function get_public_feed($channel, $params) { -/* $type = 'xml'; - $begin = NULL_DATE; - $end = ''; - $start = 0; - $records = 40; - $direction = 'desc'; - $pages = 0; -*/ - if(! $params) $params = []; @@ -106,23 +97,15 @@ function get_feed_for($channel, $observer_hash, $params) { $owner = atom_render_author('zot:owner',$channel); $atom .= replace_macros($feed_template, array( - '$version' => xmlify(Zotlabs\Lib\System::get_project_version()), - '$red' => xmlify(Zotlabs\Lib\System::get_platform_name()), - '$feed_id' => xmlify($channel['xchan_url']), - '$feed_title' => xmlify($channel['channel_name']), - '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), - '$author' => $feed_author, - '$owner' => $owner, - '$name' => xmlify($channel['channel_name']), - '$profile_page' => xmlify($channel['xchan_url']), - '$mimephoto' => xmlify($channel['xchan_photo_mimetype']), - '$photo' => xmlify($channel['xchan_photo_l']), - '$thumb' => xmlify($channel['xchan_photo_m']), - '$picdate' => '', - '$uridate' => '', - '$namdate' => '', - '$birthday' => '', - '$community' => '', + '$version' => xmlify(Zotlabs\Lib\System::get_project_version()), + '$generator' => xmlify(Zotlabs\Lib\System::get_platform_name()), + '$generator_uri' => 'https://hubzilla.org', + '$feed_id' => xmlify($channel['xchan_url']), + '$feed_title' => xmlify($channel['channel_name']), + '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), + '$author' => $feed_author, + '$owner' => $owner, + '$profile_page' => xmlify($channel['xchan_url']), )); @@ -1843,10 +1826,24 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ create_export_photo_body($item); - if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) - $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid); + // provide separate summary and content unless compat is true; as summary represents a content-warning on some networks + + $matches = false; + if(preg_match('|\[summary\](.*?)\[/summary\]|ism',$item['body'],$matches)) + $summary = $matches[1]; else - $body = $item['body']; + $summary = ''; + + $body = $item['body']; + + if($summary) + $body = preg_replace('|^(.*?)\[summary\](.*?)\[/summary\](.*?)$|ism','$1$3',$item['body']); + + if($compat) + $summary = ''; + + if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) + $body = fix_private_photos($body,$owner['uid'],$item,$cid); if($compat) { $compat_photos = compat_photos_list($body); @@ -1887,6 +1884,8 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $ } else { $o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n"; + if($summary) + $o .= '<summary type="' . $type . '" >' . xmlify(prepare_text($summary,$item['mimetype'])) . '</summary>' . "\r\n"; $o .= '<content type="' . $type . '" >' . xmlify(prepare_text($body,$item['mimetype'])) . '</content>' . "\r\n"; } diff --git a/include/hubloc.php b/include/hubloc.php index 0daa5908c..0d1a2e560 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -257,6 +257,24 @@ function hubloc_mark_as_down($posturl) { } +/** + * @brief return comma separated string of non-dead clone locations (net addresses) for a given netid + * + * @param string $netid network identity (typically xchan_hash or hubloc_hash) + * @return string + */ + +function locations_by_netid($netid) { + + $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' and hubloc_deleted = 0 and site_dead = 0", + dbesc($netid) + ); + + return array_elm_to_str($locs,'location',', '); + +} + + function ping_site($url) { diff --git a/include/text.php b/include/text.php index 8ec6ebace..10bbc751a 100644 --- a/include/text.php +++ b/include/text.php @@ -3261,3 +3261,31 @@ function purify_filename($s) { return ''; return $s; } + + +/** + * @brief array_elm_to_str($arr,$elm,$delim = ',') extract unique individual elements from an array of arrays and return them as a string separated by a delimiter + * + * empty elements (evaluated after trim()) are ignored. + * @param $arr array + * @param $elm array key to extract from sub-array + * @param $delim string default ',' + * @returns string + */ + +function array_elm_to_str($arr,$elm,$delim = ',') { + + $tmp = []; + if($arr && is_array($arr)) { + foreach($arr as $x) { + if(is_array($x) && array_key_exists($elm,$x)) { + $z = trim($x[$elm]); + if(($z) && (! in_array($z,$tmp))) { + $tmp[] = $z; + } + } + } + } + return implode($tmp,$delim); +} + diff --git a/view/tpl/atom_feed.tpl b/view/tpl/atom_feed.tpl index b1e92cdbf..8dc145ae9 100755 --- a/view/tpl/atom_feed.tpl +++ b/view/tpl/atom_feed.tpl @@ -13,7 +13,7 @@ <id>{{$feed_id}}</id> <title>{{$feed_title}}</title> - <generator uri="http://hubzilla.org" version="{{$version}}">{{$red}}</generator> + <generator uri="{{$generator_uri}}" version="{{$version}}">{{$generator}}</generator> <link rel="license" href="http://creativecommons.org/licenses/by/3.0/" /> {{if $profile_page}} <link rel="alternate" type="text/html" href="{{$profile_page}}" /> diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 0f27b1a47..211e8e05b 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -33,6 +33,14 @@ {{if $module != 'hq' && $startpage == 'hq'}} e.preventDefault(); + if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') { + $.post( + "hq", + { + "notify_id" : notify_id + } + ); + } window.location.href = 'hq/' + b64mid; return; {{else}} |