diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-03-30 15:07:48 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-30 15:07:48 +0200 |
commit | bb639b08f795f81ffb58787fd195c7a235d1637c (patch) | |
tree | 63e1371555c356cbb83a16c3821c77c3ef2cea2d /Zotlabs/Module | |
parent | 5167f700150cffe522911d56859d898b95f7b0e8 (diff) | |
download | volse-hubzilla-bb639b08f795f81ffb58787fd195c7a235d1637c.tar.gz volse-hubzilla-bb639b08f795f81ffb58787fd195c7a235d1637c.tar.bz2 volse-hubzilla-bb639b08f795f81ffb58787fd195c7a235d1637c.zip |
do not allow creating two wikis with the same name
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Wiki.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 9adef1795..a1e377e68 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -236,11 +236,10 @@ class Wiki extends \Zotlabs\Web\Controller { $mimeType = $p['mimeType']; - $rawContent = htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT); + $sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page')); - $rawContent = $p['content']; + $content = (($p['content'] == '') ? $sampleContent : $p['content']); - $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); // Render the Markdown-formatted page content in HTML if($mimeType == 'text/bbcode') { $renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName); @@ -364,6 +363,14 @@ class Wiki extends \Zotlabs\Web\Controller { if($wiki['urlName'] === '') { notice( t('Error creating wiki. Invalid name.') . EOL); goaway('/wiki'); + return; //not reached + } + + $exists = Zlib\NativeWiki::exists_by_name($owner['channel_id'], $wiki['urlName']); + if($exists['id']) { + notice( t('A wiki with this name already exists.') . EOL); + goaway('/wiki'); + return; //not reached } // Get ACL for permissions |