aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-12 23:15:30 -0700
committerzotlabs <mike@macgirvin.com>2017-09-12 23:15:30 -0700
commit796228b7ad3cac90b23de2954445021578635105 (patch)
tree9e6170a02e2f100c47ba06a5b3026b957351801f /Zotlabs
parent7489a4442ea2041450b3477400c0ecb29b8670d9 (diff)
downloadvolse-hubzilla-796228b7ad3cac90b23de2954445021578635105.tar.gz
volse-hubzilla-796228b7ad3cac90b23de2954445021578635105.tar.bz2
volse-hubzilla-796228b7ad3cac90b23de2954445021578635105.zip
wiki mimetype selection. We can add text/plain as soon as we add code to purify and render it specifically.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php14
-rw-r--r--Zotlabs/Module/Wiki.php7
2 files changed, 12 insertions, 9 deletions
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);