From 3be41b687aebfd3e0bba4dcd1dccbd10ad7f87a0 Mon Sep 17 00:00:00 2001 From: shish Date: Mon, 28 May 2007 23:12:43 +0000 Subject: [PATCH] wiki:default is used as content for blank pages git-svn-id: file:///home/shish/svn/shimmie2/trunk@139 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/wiki/main.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/contrib/wiki/main.php b/contrib/wiki/main.php index dc36d24a..0f6ba497 100644 --- a/contrib/wiki/main.php +++ b/contrib/wiki/main.php @@ -78,9 +78,9 @@ class Wiki extends Extension { $content = $this->get_page($title); if(isset($_GET['save']) && $_GET['save'] == "on") { $title = $_POST['title']; - $rev = $_POST['revision']; + $rev = int_escape($_POST['revision']); $body = $_POST['body']; - $lock = $_POST['lock']; + $lock = isset($_POST['lock']) && ($_POST['lock'] == "on"); global $user; if($this->can_edit($user, $this->get_page($title))) { @@ -106,9 +106,20 @@ class Wiki extends Extension { } } else if(is_null($content)) { + $default = $this->get_page("wiki:default"); $blank = new WikiPage(); $blank->title = $title; - $page->add_main_block(new Block("Content", $this->create_edit_html($blank))); + if(!is_null($default) && !isset($_GET['edit'])) { + global $config; + $blank->body = $default->body; + $blank->owner_id = $config->get_int('anon_id'); + $blank->date = $default->date; + $content = $this->create_display_html($blank); + } + else { + $content = $this->create_edit_html($blank); + } + $page->add_main_block(new Block("Content", $content)); } else if(isset($_GET['edit']) && $_GET['edit'] == "on") { $page->add_main_block(new Block("Content", $this->create_edit_html($content)));