aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Wiki.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-28 07:17:42 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-28 07:17:42 -0400
commitf884fa66782544cd6fc44a81b978a905d4755cea (patch)
tree8330844f0e1c2f6b2ab6b80836fc3437bc38dc12 /Zotlabs/Module/Wiki.php
parent4691c3ec01eda972e7b4cae4ec940c8c24d51b5a (diff)
downloadvolse-hubzilla-f884fa66782544cd6fc44a81b978a905d4755cea.tar.gz
volse-hubzilla-f884fa66782544cd6fc44a81b978a905d4755cea.tar.bz2
volse-hubzilla-f884fa66782544cd6fc44a81b978a905d4755cea.zip
Wiki page list is fetched and the page widget is updated
Diffstat (limited to 'Zotlabs/Module/Wiki.php')
-rw-r--r--Zotlabs/Module/Wiki.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 909b2c84d..9d905f561 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -92,8 +92,6 @@ class Wiki extends \Zotlabs\Web\Controller {
function post() {
require_once('include/wiki.php');
- // TODO: Implement wiki API
-
// Render mardown-formatted text in HTML
if((argc() > 2) && (argv(2) === 'preview')) {
$content = $_POST['content'];
@@ -212,8 +210,22 @@ class Wiki extends \Zotlabs\Web\Controller {
}
}
- notice('You must be authenticated.');
- goaway('/wiki');
+ // Fetch page list for a wiki
+ if ((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) {
+ $resource_id = $_POST['resource_id']; // resource_id for wiki in db
+ $channel = get_channel_by_nick(argv(1));
+ $observer_hash = get_observer_hash();
+ $perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
+ if(!$perms['read']) {
+ logger('Wiki read permission denied.' . EOL);
+ json_return_and_die(array('pages' => null, 'message' => 'Permission denied.', 'success' => false));
+ }
+ $page_list_html = widget_wiki_pages(array('resource_id' => $resource_id));
+ json_return_and_die(array('pages' => $page_list_html, 'message' => '', 'success' => true));
+ }
+
+ //notice('You must be authenticated.');
+ json_return_and_die(array('message' => 'You must be authenticated.', 'success' => false));
}
}