summaryrefslogtreecommitdiff
path: root/IkiWiki/CGI.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-03-24 05:03:16 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-03-24 05:03:16 +0000
commit49524c429e8dec4e18a81dfcfbbc93cbd1da32c3 (patch)
treed07c9fd97d7ff19a9cdd4e0e7f8e426f01168fc4 /IkiWiki/CGI.pm
parent5e7a3e74289248f464eb004b4e2176b27abe062e (diff)
add blog post template
Diffstat (limited to 'IkiWiki/CGI.pm')
-rw-r--r--IkiWiki/CGI.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 29f3ecc89..b540a7b37 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -467,11 +467,28 @@ sub cgi () { #{{{
error("\"do\" parameter missing");
}
- # This does not need a session.
+ # Things that do not need a session.
if ($do eq 'recentchanges') {
cgi_recentchanges($q);
return;
}
+ elsif ($do eq 'blog') {
+ # munge page name to be valid, no matter what freeform text
+ # is entered
+ my $page=$q->param('title');
+ $page=~y/ /_/;
+ $page=~s/([^-A-Za-z0-9_.:+])/"__".ord($1)."__"/eg;
+ # if the page already exist, munge it to be unique
+ my $from=$q->param('from');
+ my $add="";
+ while (exists $pagectime{"$from/$page$add"}) {
+ $add=1 unless length $add;
+ $add++;
+ }
+ $q->param('page', $page.$add);
+ $q->param('do', 'create');
+ # now it behaves same as create does
+ }
CGI::Session->name("ikiwiki_session");