From 4ff89a58625e647ee74087dfab79ac6dd76cbe6c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 12 Sep 2017 20:24:57 -0700 Subject: drop salmon until we improve performance --- Zotlabs/Lib/LDSignatures.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/LDSignatures.php b/Zotlabs/Lib/LDSignatures.php index 7d468782a..fa2758044 100644 --- a/Zotlabs/Lib/LDSignatures.php +++ b/Zotlabs/Lib/LDSignatures.php @@ -16,7 +16,8 @@ class LDSignatures { } static function dopplesign(&$data,$channel) { - $data['magicEnv'] = self::salmon_sign($data,$channel); + // remove for the time being - performance issues + // $data['magicEnv'] = self::salmon_sign($data,$channel); return self::sign($data,$channel); } -- cgit v1.2.3 From 5e99295bf6f85e7a6d50e0c8f0701a9b37f03332 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 12 Sep 2017 22:32:31 -0700 Subject: wiki mimetype selection --- Zotlabs/Lib/NativeWikiPage.php | 8 +++++++- Zotlabs/Module/Wiki.php | 10 ++++++---- Zotlabs/Widget/Wiki_pages.php | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index 78b54ebda..97dad5813 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -55,7 +55,12 @@ class NativeWikiPage { } - static public function create_page($channel_id, $observer_hash, $name, $resource_id) { + static public function create_page($channel_id, $observer_hash, $name, $resource_id, $mimetype = 'text/bbcode') { + + logger('mimetype: ' . $mimetype); + + if(! in_array($mimetype,[ 'text/markdown','text/bbcode','text/plain','text/html'])) + $mimetype = 'text/markdown; $w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id); @@ -68,6 +73,7 @@ class NativeWikiPage { $arr = []; $arr['uid'] = $channel_id; $arr['author_xchan'] = $observer_hash; + $arr['mimetype'] = $mimetype; $arr['resource_type'] = 'nwikipage'; $arr['resource_id'] = $resource_id; $arr['allow_cid'] = $w['wiki']['allow_cid']; diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 4dc11c683..3fb980955 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -406,7 +406,7 @@ class Wiki extends \Zotlabs\Web\Controller { $r = Zlib\NativeWiki::create_wiki($owner, $observer_hash, $wiki, $acl); if($r['success']) { Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']); - $homePage = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash,'Home', $r['item']['resource_id']); + $homePage = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash,'Home', $r['item']['resource_id'], $wiki['mimeType']); if(! $homePage['success']) { notice( t('Wiki created, but error creating Home page.')); goaway(z_root() . '/wiki/' . $nick . '/' . $wiki['urlName']); @@ -445,11 +445,13 @@ class Wiki extends \Zotlabs\Web\Controller { // Create a page if ((argc() === 4) && (argv(2) === 'create') && (argv(3) === 'page')) { + $mimetype = $_POST['mimetype']; + $resource_id = $_POST['resource_id']; // Determine if observer has permission to create a page + - - $perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash); + $perms = Zlib\NativeWiki::get_permissions($resource_id, intval($owner['channel_id']), $observer_hash, $mimetype); if(! $perms['write']) { logger('Wiki write permission denied. ' . EOL); json_return_and_die(array('success' => false)); @@ -459,7 +461,7 @@ class Wiki extends \Zotlabs\Web\Controller { if(urlencode(escape_tags($_POST['pageName'])) === '') { json_return_and_die(array('message' => 'Error creating page. Invalid name.', 'success' => false)); } - $page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id); + $page = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash, $name, $resource_id, $mimetype); if($page['item_id']) { $commit = Zlib\NativeWikiPage::commit(array( diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php index 7285e2b42..ac6549ffd 100644 --- a/Zotlabs/Widget/Wiki_pages.php +++ b/Zotlabs/Widget/Wiki_pages.php @@ -50,6 +50,7 @@ class Wiki_pages { '$canadd' => $can_create, '$candel' => $can_delete, '$addnew' => t('Add new page'), + '$mimetype' => mimetype_select(0,$p['mimeType'], [ 'text/markdown','text/bbcode' ]), '$pageName' => array('pageName', t('Page name')), '$refresh' => $arr['refresh'] )); -- cgit v1.2.3 From 7489a4442ea2041450b3477400c0ecb29b8670d9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 12 Sep 2017 22:35:30 -0700 Subject: wiki mimetype --- Zotlabs/Lib/NativeWikiPage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index 97dad5813..dd1e8f9d9 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -60,7 +60,7 @@ class NativeWikiPage { logger('mimetype: ' . $mimetype); if(! in_array($mimetype,[ 'text/markdown','text/bbcode','text/plain','text/html'])) - $mimetype = 'text/markdown; + $mimetype = 'text/markdown'; $w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id); -- cgit v1.2.3 From 796228b7ad3cac90b23de2954445021578635105 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 12 Sep 2017 23:15:30 -0700 Subject: wiki mimetype selection. We can add text/plain as soon as we add code to purify and render it specifically. --- Zotlabs/Lib/NativeWikiPage.php | 14 ++++++++------ Zotlabs/Module/Wiki.php | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index dd1e8f9d9..ffd5aec31 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -59,7 +59,7 @@ class NativeWikiPage { logger('mimetype: ' . $mimetype); - if(! in_array($mimetype,[ 'text/markdown','text/bbcode','text/plain','text/html'])) + if(! in_array($mimetype,[ 'text/markdown','text/bbcode','text/plain','text/html' ])) $mimetype = 'text/markdown'; $w = Zlib\NativeWiki::get_wiki($channel_id, $observer_hash, $resource_id); @@ -173,10 +173,11 @@ class NativeWikiPage { $content = $item['body']; return [ - 'content' => $content, - 'mimeType' => $w['mimeType'], - 'message' => '', - 'success' => true + 'content' => $content, + 'mimeType' => $w['mimeType'], + 'pageMimeType' => $item['mimetype'], + 'message' => '', + 'success' => true ]; } @@ -339,7 +340,6 @@ class NativeWikiPage { return array('message' => t('Error reading wiki'), 'success' => false); } - $mimetype = $w['mimeType']; // fetch the most recently saved revision. @@ -348,6 +348,8 @@ class NativeWikiPage { return array('message' => t('Page not found'), 'success' => false); } + $mimetype = $item['mimetype']; + // change just the fields we need to change to create a revision; unset($item['id']); diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 3fb980955..df747a07a 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -259,7 +259,7 @@ class Wiki extends \Zotlabs\Web\Controller { goaway(z_root() . '/' . argv(0) . '/' . argv(1) ); } - $mimeType = $p['mimeType']; + $mimeType = $p['pageMimeType']; $sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page')); @@ -323,7 +323,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$modalerroralbum' => t('Error getting album'), )); - if($p['mimeType'] != 'text/bbcode') + if($p['pageMimeType'] != 'text/bbcode') head_add_js('/library/ace/ace.js'); // Ace Code Editor return $o; @@ -347,11 +347,12 @@ class Wiki extends \Zotlabs\Web\Controller { if((argc() > 2) && (argv(2) === 'preview')) { $content = $_POST['content']; $resource_id = $_POST['resource_id']; + $w = Zlib\NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id); $wikiURL = argv(0) . '/' . argv(1) . '/' . $w['urlName']; - $mimeType = $w['mimeType']; + $mimeType = $_POST['mimetype']; if($mimeType == 'text/bbcode') { $html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL); -- cgit v1.2.3