From a2a2683c16e0c838c1cb77cbd972db114e3eadff Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 19 Jul 2020 08:10:51 +0100 Subject: [PATCH] add missing use_pastebin add USE_PAGE_METADATA fix use of APP_DIR in wiki.php createAction --- wiki.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wiki.php b/wiki.php index 79a1d00..c7cc42a 100644 --- a/wiki.php +++ b/wiki.php @@ -98,7 +98,8 @@ protected function _render($page) 'parts' => $parts, 'page' => $page_data, 'html' => $list, - 'is_dir' => true + 'is_dir' => true, + 'use_pastebin' => $this->_usePasteBin() )); return; } @@ -126,7 +127,8 @@ protected function _render($page) . "" . "" , - 'is_dir' => false + 'is_dir' => false, + 'use_pastebin' => $this->_usePasteBin() )); } } else { @@ -529,9 +531,17 @@ public function createAction() { $request = parse_url($_SERVER['REQUEST_URI']); $page = str_replace("###" . APP_DIR . "/", "", "###" . urldecode($request['path'])); + $filepath = LIBRARY . DIRECTORY_SEPARATOR . urldecode($page); - $filepath = LIBRARY . urldecode($request['path']); $content = "# " . htmlspecialchars($page, ENT_QUOTES, 'UTF-8'); + if (USE_PAGE_METADATA) { + $content = + "---\n\"title\": \"" . + htmlspecialchars($page, ENT_QUOTES, 'UTF-8') . + "\"\n---\n\n" . + $content; + } + // if feature not enabled, go to 404 if (!ENABLE_EDITING || file_exists($filepath)) { $this->_404();