From e84281b620650db8f066f2643c1f9089a88e088d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 16 Sep 2017 15:48:48 -0700 Subject: [PATCH 01/12] wiki download: only include the latest page revision --- Zotlabs/Module/Wiki.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 6055b0b38..2668229ee 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -140,11 +140,16 @@ class Wiki extends \Zotlabs\Web\Controller { $zip = new \ZipArchive; $r = $zip->open($zip_filepath, \ZipArchive::CREATE); if($r === true) { - $i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'", + $pages = []; + $i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' order by revision desc", dbesc($resource_id) ); + if($i) { foreach($i as $iv) { + if(in_array($iv['mid'],$pages)) + continue; + if($iv['mimetype'] === 'text/plain') { $content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8'); } @@ -156,6 +161,7 @@ class Wiki extends \Zotlabs\Web\Controller { } $fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv); $zip->addFromString($fname,$content); + $pages[] = $iv['mid']; } From ca24bfdc464a414ad30aec2dec307c174ef60a0f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 16 Sep 2017 16:42:01 -0700 Subject: [PATCH 02/12] wiki sync - we weren't getting the child pages --- Zotlabs/Lib/NativeWiki.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index 390b83958..22aa1817a 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -160,6 +160,12 @@ class NativeWiki { dbesc($resource_id) ); if($r) { + $q = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'", + dbesc($r[0]['resource_type']) + ); + if($q) { + $r = array_merge($r,$q); + } xchan_query($r); $sync_item = fetch_post_tags($r); build_sync_packet($uid,array('wiki' => array(encode_item($sync_item[0],true)))); From 9120a82ab4c4051b37794ca4d87ee3ae52084459 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 16 Sep 2017 16:52:25 -0700 Subject: [PATCH 03/12] wiki: update acl on child pages when wiki perms change --- Zotlabs/Lib/NativeWiki.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php index 22aa1817a..7642dbb3e 100644 --- a/Zotlabs/Lib/NativeWiki.php +++ b/Zotlabs/Lib/NativeWiki.php @@ -135,6 +135,18 @@ class NativeWiki { $item_id = $update['item_id']; + // update acl for any existing wiki pages + + q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d where resource_type = 'nwikipage' and resource_id = '%s'", + dbesc($item['allow_cid']), + dbesc($item['allow_gid']), + dbesc($item['deny_cid']), + dbesc($item['deny_gid']), + dbesc($item['item_private']), + dbesc($arr['resource_id']) + ); + + if($update['item_id']) { info( t('Wiki updated successfully')); if($update_title) { From 1d9e0f17a6e945a10c05ad6543682ad1c8cd87d9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 17 Sep 2017 18:40:32 -0700 Subject: [PATCH 04/12] more mastodon testing --- Zotlabs/Lib/ActivityStreams.php | 11 ++++++++++- include/items.php | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 2846ea476..d9735881a 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -17,6 +17,7 @@ class ActivityStreams { public $ldsig = null; public $sigok = false; public $recips = null; + public $raw_recips = null; function __construct($string) { @@ -53,13 +54,21 @@ class ActivityStreams { return $this->valid; } + function set_recips($arr) { + $this->saved_recips = $arr; + } + function collect_recips($base = '',$namespace = 'https://www.w3.org/ns/activitystreams') { $x = []; $fields = [ 'to','cc','bto','bcc','audience']; foreach($fields as $f) { $y = $this->get_compound_property($f,$base,$namespace); - if($y) + if($y) { $x = array_merge($x,$y); + if(! is_array($this->raw_recips)) + $this->raw_recips = []; + $this->raw_recips[$f] = $x; + } } // not yet ready for prime time // $x = $this->expand($x,$base,$namespace); diff --git a/include/items.php b/include/items.php index f286015fe..daf41aa4b 100755 --- a/include/items.php +++ b/include/items.php @@ -2498,6 +2498,9 @@ function tag_deliver($uid, $item_id) { $pattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/'; + // statusnet style group tags + $pattern2 = '/^|[^@]\!\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/'; + if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) { $max_forums = get_config('system','max_tagged_forums'); if(! $max_forums) From 5c379b4d356169b8eada1f6e1851dbc7f5af6933 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 17 Sep 2017 23:54:40 -0700 Subject: [PATCH 05/12] acl issue with some ActivityPub completions --- Zotlabs/Module/Acl.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 9b2be0fea..769b36ce4 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -21,7 +21,7 @@ class Acl extends \Zotlabs\Web\Controller { function init() { - // logger('mod_acl: ' . print_r($_REQUEST,true)); + logger('mod_acl: ' . print_r($_REQUEST,true)); $start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0); $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 500); @@ -307,7 +307,7 @@ class Acl extends \Zotlabs\Web\Controller { $contacts[] = array( "photo" => $g['photo'], "name" => $g['name'], - "nick" => $g['address'], + "nick" => $g['address'] ); } } @@ -330,7 +330,12 @@ class Acl extends \Zotlabs\Web\Controller { continue; $g['hash'] = urlencode($g['hash']); - + + if(! $g['nick']) { + $t = explode(' ',strtolower($g['name'])); + $g['nick'] = $t[0] . '@'; + } + if(in_array($g['hash'],$permitted) && $type == 'c' && (! $noforums)) { $contacts[] = array( "type" => "c", From 9914e171b15123f5540d8483890c5bab8d596b3f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 18 Sep 2017 16:15:42 +0200 Subject: [PATCH 06/12] anonymous comments are not implemented for photos. --- Zotlabs/Module/Photos.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index bb7079a6a..f86801fcc 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -1041,7 +1041,7 @@ class Photos extends \Zotlabs\Web\Controller { $likebuttons = ''; - if($can_post || $can_comment) { + if($observer && ($can_post || $can_comment)) { $likebuttons = [ 'id' => $link_item['id'], 'likethis' => t("I like this \x28toggle\x29"), @@ -1053,7 +1053,7 @@ class Photos extends \Zotlabs\Web\Controller { $comments = ''; if(! count($r)) { - if($can_post || $can_comment) { + if($observer && ($can_post || $can_comment)) { $commentbox = replace_macros($cmnt_tpl,array( '$return_path' => '', '$mode' => 'photos', @@ -1172,7 +1172,7 @@ class Photos extends \Zotlabs\Web\Controller { } - if($can_post || $can_comment) { + if($observer && ($can_post || $can_comment)) { $commentbox = replace_macros($cmnt_tpl,array( '$return_path' => '', '$jsreload' => $return_url, From c3b3f41a21a5b56315768dbddc366934d6374c96 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 18 Sep 2017 16:37:55 +0200 Subject: [PATCH 07/12] changelog --- CHANGELOG | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f96f83b09..55a35806b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +Hubzilla 2.6.3 (2017-09-18) + - Fix anonymous comments/likes on photos - this is not yet implemented + - Fix favicon not displayed on certain pages + - Fix hubzilla logo icon for favicon and email notifications + - Fix an issue with displaying selected theme in settings/display + - [SECURITY] Restrict the input characters we accept in token verification strings to hex digits + - Remove hubzilla.nl from fallback directory servers + Hubzilla 2.6.2 (2017-08-31) - Fix webfinger returns invalid XML (github issue #851) From e812836a601f5fda32b520e9af29f89ae2227524 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 18 Sep 2017 17:46:34 -0700 Subject: [PATCH 08/12] provide rel=alternate link if no reshare content in post --- include/feedutils.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/feedutils.php b/include/feedutils.php index 145d4361c..4cc194fb1 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -811,6 +811,7 @@ function feed_get_reshare(&$res,$item) { } $attach = $share['links']; + if($attach) { foreach($attach as $att) { if($att['rel'] === 'alternate') { @@ -845,6 +846,10 @@ function feed_get_reshare(&$res,$item) { } } + if((! $body) && ($share['alternate'])) { + $body = $share['alternate']; + } + $res['body'] = "[share author='" . urlencode($share['author']) . "' profile='" . $share['profile'] . "' avatar='" . $share['avatar'] . From 4fbebe7b2d6c38747986d18ea07db5b42c2a072a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 18 Sep 2017 20:38:09 -0700 Subject: [PATCH 09/12] create new hooks for permissions_accept and permissions_reject --- Zotlabs/Daemon/Notifier.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 0e8c99572..1b8a7d412 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -59,6 +59,8 @@ require_once('include/bbcode.php'); * * ZOT * permission_create abook_id + * permission_accept abook_id + * permission_reject abook_id * permission_update abook_id * refresh_all channel_id * purge_all channel_id @@ -171,8 +173,12 @@ class Notifier { if($channel) { $perm_update = array('sender' => $channel, 'recipient' => $r[0], 'success' => false, 'deliveries' => ''); - if($cmd == 'permission_create') + if($cmd === 'permission_create') call_hooks('permissions_create',$perm_update); + elseif($cmd === 'permission_accept') + call_hooks('permissions_accept',$perm_update); + elseif($cmd === 'permission_reject') + call_hooks('permissions_reject',$perm_update); else call_hooks('permissions_update',$perm_update); From c6bcea0f82a03657611621c338a6c01059ae8ec6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 18 Sep 2017 21:55:45 -0700 Subject: [PATCH 10/12] pubcrawl: make a good faith effort to handle multi-media content --- include/feedutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feedutils.php b/include/feedutils.php index 4cc194fb1..112e10155 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1711,7 +1711,7 @@ function compat_photos_list($s) { $found = preg_match_all('/\[[zi]mg(.*?)\](.*?)\[/ism',$s,$matches,PREG_SET_ORDER); if($found) { - foreach($matches as $match) { + foreach($matches as $match) { $ret[] = [ 'href' => $match[2], 'length' => 0, From 66fb0fdcd77f46c614f8149e71ca0d4fb1757d0a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 19 Sep 2017 11:12:52 +0200 Subject: [PATCH 11/12] fix permission_{accept, reject} hooks not being called --- Zotlabs/Daemon/Notifier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 1b8a7d412..54d609ad1 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -161,7 +161,7 @@ class Notifier { $packet_type = 'keychange'; $normal_mode = false; } - elseif($cmd == 'permission_update' || $cmd == 'permission_create') { + elseif($cmd == 'permission_update' || $cmd == 'permission_reject' || $cmd == 'permission_accept' || $cmd == 'permission_create') { // Get the (single) recipient $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0", intval($item_id) From 4500faf463e7fd6fcf9948666421c941a1292df9 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 19 Sep 2017 18:59:06 +0200 Subject: [PATCH 12/12] fix various wikipage widget issues (sort pages by name, respect locked mime type setting, move create tool back to the bottom) --- Zotlabs/Lib/NativeWikiPage.php | 9 ++++++++- view/tpl/wiki_page_list.tpl | 34 +++++++++++++++++----------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index 4b637781e..209a5ef3c 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -21,7 +21,7 @@ class NativeWikiPage { $sql_extra = item_permissions_sql($channel_id,$observer_hash); $r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d and item_deleted = 0 - $sql_extra order by created asc", + $sql_extra order by title asc", dbesc($resource_id), intval($channel_id) ); @@ -74,6 +74,7 @@ class NativeWikiPage { $arr['uid'] = $channel_id; $arr['author_xchan'] = $observer_hash; $arr['mimetype'] = $mimetype; + $arr['title'] = $name; $arr['resource_type'] = 'nwikipage'; $arr['resource_id'] = $resource_id; $arr['allow_cid'] = $w['wiki']['allow_cid']; @@ -139,8 +140,14 @@ class NativeWikiPage { if($ic) { foreach($ic as $c) { set_iconfig($c['item_id'],'nwikipage','pagetitle',$pageNewName); + $ids[] = $c['item_id']; } + $str_ids = implode(',', $ids); + q("update item set title = '%s' where id in ($str_ids)", + dbesc($pageNewName) + ); + $page = [ 'rawName' => $pageNewName, 'htmlName' => escape_tags($pageNewName), diff --git a/view/tpl/wiki_page_list.tpl b/view/tpl/wiki_page_list.tpl index bf5f6697d..a7e6ebdaf 100644 --- a/view/tpl/wiki_page_list.tpl +++ b/view/tpl/wiki_page_list.tpl @@ -3,23 +3,6 @@ {{/if}}

{{$header}}

{{if ! $refresh}}