aboutsummaryrefslogtreecommitdiffstats
path: root/include/wiki.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-28 15:11:19 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-28 15:11:19 -0400
commitab54bf514921ae3fe0fafcdf154364815ed6375f (patch)
tree2066bc43694b344623f567fd5a87d5e77193794a /include/wiki.php
parent55b587002ea7e892d20010800f5892949f56d34a (diff)
downloadvolse-hubzilla-ab54bf514921ae3fe0fafcdf154364815ed6375f.tar.gz
volse-hubzilla-ab54bf514921ae3fe0fafcdf154364815ed6375f.tar.bz2
volse-hubzilla-ab54bf514921ae3fe0fafcdf154364815ed6375f.zip
Wiki pages can be saved.
Diffstat (limited to 'include/wiki.php')
-rw-r--r--include/wiki.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/wiki.php b/include/wiki.php
index f97036c29..e01cc12c3 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -232,4 +232,26 @@ function wiki_get_page_content($arr) {
// TODO: Check that the files are all text files
return array('content' => json_encode($content), 'message' => '', 'success' => true);
}
+}
+
+
+function wiki_save_page($arr) {
+ $pagename = ((array_key_exists('name',$arr)) ? $arr['name'] : '');
+ $content = ((array_key_exists('content',$arr)) ? $arr['content'] : '');
+ $resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : '');
+ $w = wiki_get_wiki($resource_id);
+ if (!$w['path']) {
+ return array('message' => 'Error reading wiki', 'success' => false);
+ }
+ $page_path = $w['path'].'/'.$pagename;
+ if (is_writable($page_path) === true) {
+ if(!file_put_contents($page_path, $content)) {
+ return array('message' => 'Error writing to page file', 'success' => false);
+ }
+ return array('message' => '', 'success' => true);
+ } else {
+ return array('message' => 'Page file not writable', 'success' => false);
+ }
+
+
} \ No newline at end of file