aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-28 12:33:07 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-28 12:33:07 -0400
commit7393dccde816bafca2e3efe534fae56339e2c536 (patch)
tree8024af20c55e600481a6d81642abbecadcd425e3 /include
parentae94e8a855d31125b96e158c0fb8c0d6f22631d6 (diff)
downloadvolse-hubzilla-7393dccde816bafca2e3efe534fae56339e2c536.tar.gz
volse-hubzilla-7393dccde816bafca2e3efe534fae56339e2c536.tar.bz2
volse-hubzilla-7393dccde816bafca2e3efe534fae56339e2c536.zip
Page content is loaded from the file on disk
Diffstat (limited to 'include')
-rw-r--r--include/wiki.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/wiki.php b/include/wiki.php
index c1779e208..f97036c29 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -210,3 +210,26 @@ function wiki_create_page($name, $resource_id) {
}
}
+
+function wiki_get_page_content($arr) {
+ $page = ((array_key_exists('page',$arr)) ? $arr['page'] : '');
+ // TODO: look for page resource_id and retrieve that way alternatively
+ $wiki_resource_id = ((array_key_exists('wiki_resource_id',$arr)) ? $arr['wiki_resource_id'] : '');
+ $w = wiki_get_wiki($wiki_resource_id);
+ if (!$w['path']) {
+ return array('content' => null, 'message' => 'Error reading wiki', 'success' => false);
+ }
+ $page_path = $w['path'].'/'.$page;
+ if (is_readable($page_path) === true) {
+ if(filesize($page_path) === 0) {
+ $content = '';
+ } else {
+ $content = file_get_contents($page_path);
+ if(!$content) {
+ return array('content' => null, 'message' => 'Error reading page content', 'success' => false);
+ }
+ }
+ // TODO: Check that the files are all text files
+ return array('content' => json_encode($content), 'message' => '', 'success' => true);
+ }
+} \ No newline at end of file