aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-04 06:26:41 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-04 06:26:41 -0400
commitb5d8443f59d96cece2357b6a791fe8ffe854dd95 (patch)
treea0368e104685f74d5ac1d4fef650034e393af841 /Zotlabs
parentc08f428b5e7979e87250c2b0a30cd16344b395d9 (diff)
downloadvolse-hubzilla-b5d8443f59d96cece2357b6a791fe8ffe854dd95.tar.gz
volse-hubzilla-b5d8443f59d96cece2357b6a791fe8ffe854dd95.tar.bz2
volse-hubzilla-b5d8443f59d96cece2357b6a791fe8ffe854dd95.zip
Created three distinct names for wiki and page that are suitable for URL, HTML, and raw display. Implemented in new wiki POST activity only so far.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Wiki.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index ef7b4dfe1..c74fc6c6f 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -174,22 +174,26 @@ class Wiki extends \Zotlabs\Web\Controller {
goaway('/'.argv(0).'/'.argv(1).'/'.argv(2));
}
}
- $name = escape_tags(urlencode($_POST['wikiName'])); //Get new wiki name
- if($name === '') {
+ $wiki = array();
+ // Generate new wiki info from input name
+ $wiki['rawName'] = $_POST['wikiName'];
+ $wiki['htmlName'] = escape_tags($_POST['wikiName']);
+ $wiki['urlName'] = urlencode(escape_tags($_POST['wikiName']));
+ if($wiki['urlName'] === '') {
notice('Error creating wiki. Invalid name.');
goaway('/wiki');
}
// Get ACL for permissions
$acl = new \Zotlabs\Access\AccessList($channel);
$acl->set_from_array($_POST);
- $r = wiki_create_wiki($channel, $observer_hash, $name, $acl);
+ $r = wiki_create_wiki($channel, $observer_hash, $wiki, $acl);
if ($r['success']) {
- $homePage = wiki_create_page('Home.md', $r['item']['resource_id']);
+ $homePage = wiki_create_page('Home', $r['item']['resource_id']);
if(!$homePage['success']) {
notice('Wiki created, but error creating Home page.');
- goaway('/wiki/'.$nick.'/'.$name);
+ goaway('/wiki/'.$nick.'/'.$wiki['urlName']);
}
- goaway('/wiki/'.$nick.'/'.$name.'/Home.md');
+ goaway('/wiki/'.$nick.'/'.$wiki['urlName'].'/'.$homePage['urlName']);
} else {
notice('Error creating wiki');
goaway('/wiki');