diff options
author | Dennis Ploeger <develop@dieploegers.de> | 2007-10-12 15:59:30 +0200 |
---|---|---|
committer | Dennis Ploeger <develop@dieploegers.de> | 2007-10-12 15:59:30 +0200 |
commit | 3a1dad2d15fb82250c76f4ff1ec789d14d38d4fc (patch) | |
tree | 260a8223797955bb0d843c281b82b100007821cf /lib/exe/xmlrpc.php | |
parent | 9a87c72a533121b83c56075947a3e27c853b2188 (diff) | |
download | rpg-3a1dad2d15fb82250c76f4ff1ec789d14d38d4fc.tar.gz rpg-3a1dad2d15fb82250c76f4ff1ec789d14d38d4fc.tar.bz2 |
xmlrpc_putpage
Adds the putpage-method to the xmlrpc-server-code
darcs-hash:20071012135930-b8925-1d770de41b3e6aea4c612666194e915dda344647.gz
Diffstat (limited to 'lib/exe/xmlrpc.php')
-rw-r--r-- | lib/exe/xmlrpc.php | 48 |
1 files changed, 46 insertions, 2 deletions
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 @@ <?php -if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); // fix when '<?xml' isn't on the very first line if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); @@ -92,11 +92,17 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { array('struct','string','int'), 'Returns a struct with infos about the page.' ); + + $this->addCallback( + 'wiki.putPage', + 'this:putPage', + array('int', 'string', 'string'), + 'Saves a wiki page' + ); /* FIXME: missing, yet 'wiki.getRecentChanges' 'wiki.listLinks' - 'wiki.putPage' */ $this->serve(); @@ -164,6 +170,44 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { } /** + * 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 */ function wiki_RPCVersion(){ |