From ca78ebce6d254f244b4c1fbe25eb3aca40b26952 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 27 May 2016 20:37:37 -0400 Subject: Check if wiki exists and redirect if it does not --- Zotlabs/Module/Wiki.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 221068e0a..290c2e005 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -26,6 +26,7 @@ class Wiki extends \Zotlabs\Web\Controller { } function get() { + require_once('include/wiki.php'); require_once('include/acl_selectors.php'); if(local_channel()) { $channel = \App::get_channel(); @@ -56,6 +57,10 @@ class Wiki extends \Zotlabs\Web\Controller { } elseif (argc()<4) { $wikiheader = 'Empty wiki: ' . rawurldecode(argv(2)); // show wiki name $hide_editor = true; + // Check if wiki exists andr redirect if it does not + if(!wiki_exists_by_name(argv(2))['id']) { + goaway('/'.argv(0).'/'.argv(1)); + } } elseif (argc()<5) { $wikiheader = rawurldecode(argv(2)) . ': ' . rawurldecode(argv(3)); // show wiki name and page $hide_editor = false; @@ -112,7 +117,7 @@ class Wiki extends \Zotlabs\Web\Controller { // then, use webpage permissions if (!$perms['write_pages']) { notice(t('Permission denied.') . EOL); - goaway(argv(0).'/'.argv(1).'/'.argv(2)); + goaway('/'.argv(0).'/'.argv(1).'/'.argv(2)); } } $name = escape_tags(urlencode($_POST['wikiName'])); //Get new wiki name -- cgit v1.2.3