From 3a1dad2d15fb82250c76f4ff1ec789d14d38d4fc Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Fri, 12 Oct 2007 15:59:30 +0200 Subject: xmlrpc_putpage Adds the putpage-method to the xmlrpc-server-code darcs-hash:20071012135930-b8925-1d770de41b3e6aea4c612666194e915dda344647.gz --- lib/exe/xmlrpc.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 51d9778b8..aa9d35ada 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -1,5 +1,5 @@ addCallback( + 'wiki.putPage', + 'this:putPage', + array('int', 'string', 'string'), + 'Saves a wiki page' + ); /* FIXME: missing, yet 'wiki.getRecentChanges' 'wiki.listLinks' - 'wiki.putPage' */ $this->serve(); @@ -163,6 +169,44 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { return $data; } + /** + * Save a wiki page + */ + + function putPage($put_id, $put_text, $put_summary='', $put_minor=0, $put_rev = '', $put_pre = '', $put_suf = '') { + + global $TEXT; + + $TEXT = $put_text; + + // Check, if page is locked + + if (checklock($put_id) !== false) { + + return 1; + + } + + //spam check + if(checkwordblock()) + return 2; + + // lock the page + + lock($put_id); + + // save it + + saveWikiText($put_id,con($put_pre,$put_text,$put_suf,1),$put_summary,$put_minor); //use pretty mode for con + + // unlock it + + unlock($put_id); + + return 0; + + } + /** * The version of Wiki RPC API supported */ -- cgit v1.2.3