aboutsummaryrefslogtreecommitdiffstats
path: root/include/wiki.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-11-28 11:29:10 +0100
committerMario Vavti <mario@mariovavti.com>2016-11-28 11:29:10 +0100
commit1ce4eda0b92e13615991ec22d3b789c640991431 (patch)
tree46e6634f403d9e2d9870b2aaee8287c41d4bc8e3 /include/wiki.php
parent68fd1c28b0bf21864753106e4345f0908b4f2e49 (diff)
downloadvolse-hubzilla-1ce4eda0b92e13615991ec22d3b789c640991431.tar.gz
volse-hubzilla-1ce4eda0b92e13615991ec22d3b789c640991431.tar.bz2
volse-hubzilla-1ce4eda0b92e13615991ec22d3b789c640991431.zip
wiki: move delete page functionality to the widget
Diffstat (limited to 'include/wiki.php')
-rw-r--r--include/wiki.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/include/wiki.php b/include/wiki.php
index d2cb51bd3..eb87840f6 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -31,16 +31,29 @@ function wiki_page_list($resource_id) {
if (!$w['path']) {
return array('pages' => null, 'wiki' => null);
}
- $pages = array();
- $pages[] = array('title' => 'Home', 'url' => 'Home');
+
+ $pages[] = [
+ 'resource_id' => '',
+ 'title' => 'Home',
+ 'url' => 'Home',
+ 'link_id' => 'id_wiki_home_0'
+ ];
+
if (is_dir($w['path']) === true) {
$files = array_diff(scandir($w['path']), array('.', '..', '.git'));
// TODO: Check that the files are all text files
-
+ $i = 1;
foreach($files as $file) {
// strip the .md file extension and unwrap URL encoding to leave HTML encoded name
- if( urldecode(substr($file, 0, -3)) !== 'Home') {
- $pages[] = array('title' => urldecode(substr($file, 0, -3)), 'url' => urlencode(substr($file, 0, -3)));
+ $title = substr($file, 0, -3);
+ if(urldecode($title) !== 'Home') {
+ $pages[] = [
+ 'resource_id' => $resource_id,
+ 'title' => urldecode($title),
+ 'url' => $title,
+ 'link_id' => 'id_' . substr($resource_id, 0, 10) . '_' . $i
+ ];
+ $i++;
}
}
}