From f7b2cfcf50f12ad6ce7358f74e8db9d6083aa284 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Jan 2009 20:46:55 -0500 Subject: checkcontent: New hook, can be used to implement arbitrary content filters, including spam filters. --- doc/plugins/write.mdwn | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 405876d58..99eea3d16 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -303,7 +303,7 @@ can check if the session object has a "name" parameter set. ### canedit - hook(type => "canedit", id => "foo", call => \&pagelocked); + hook(type => "canedit", id => "foo", call => \&canedit); This hook can be used to implement arbitrary access methods to control when a page can be edited using the web interface (commits from revision control @@ -321,6 +321,26 @@ This hook should avoid directly redirecting the user to a signin page, since it's sometimes used to test to see which pages in a set of pages a user can edit. +### checkcontent + + hook(type => "checkcontent", id => "foo", call => \&checkcontent); + +This hook is called to check the content a user has entered on a page, +before it is saved, and decide if it should be allowed. + +It is passed named parameters: `content`, `page`, `cgi`, and `session`. If +the content the user has entered is a comment, it may also be passed some +additional parameters: `author`, `url`, and `subject`. The `subject` +parameter may also be filled with the user's comment about the change. + +Note: When the user edits an existing wiki page, the passed `content` will +include only the lines that they added to the page, or modified. + +The hook should return `undef` on success. If the content is disallowed, it +should return a message stating what the problem is, or a function +that can be run to perform whatever action is necessary to allow the user +to post the content. + ### editcontent hook(type => "editcontent", id => "foo", call => \&editcontent); -- cgit v1.2.3