From 222572bfc222713bad7b94586d679cc052f5342b Mon Sep 17 00:00:00 2001 From: Michael Klier Date: Fri, 25 Jan 2008 18:18:34 +0100 Subject: XMLRC: refactored putPage() darcs-hash:20080125171834-23886-090763a4733f72b62c539a3ae2ff4835bd10a040.gz --- lib/exe/xmlrpc.php | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 275d23b7a..926bdb9ac 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -94,7 +94,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { $this->addCallback( 'wiki.putPage', 'this:putPage', - array('int', 'string', 'string'), + array('int', 'string', 'string', 'struct'), 'Saves a wiki page' ); $this->addCallback( @@ -176,26 +176,39 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { /** * Save a wiki page - * FIXME check ACL !!! + * + * @author Michael Klier */ - function putPage($put_id, $put_text, $put_summary='', $put_minor=0, $put_rev='', $put_pre='', $put_suf='') { + function putPage($id, $text, $params) { global $TEXT; - $TEXT = $put_text; + $id = cleanID($id); + $TEXT = trim($text); + $sum = $params['sum']; + $minor = $params['minor']; + + if(empty($id)) + return new IXR_Error(1, 'Empty Page ID'); + + if(auth_quickaclcheck($id) < AUTH_WRITE) + return new IXR_Error(1, 'You are not allowed to edit this page'); // Check, if page is locked - if (checklock($put_id) !== false) - return 1; + if(checklock($id)) + return new IXR_Error(1, 'The page is currently locked'); + + if(empty($TEXT)) + return new IXR_Error(1, 'No Text supplied'); //spam check if(checkwordblock()) - return 2; + return new IXR_Error(1, 'Positive wordblock check'); - lock($put_id); + lock($id); - saveWikiText($put_id,con($put_pre,$put_text,$put_suf,1),$put_summary,$put_minor); + saveWikiText($id,$TEXT,$sum,$minor); - unlock($put_id); + unlock($id); return 0; } -- cgit v1.2.3