summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/IXR_Library.php5
-rw-r--r--lib/exe/xmlrpc.php48
2 files changed, 49 insertions, 4 deletions
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php
index 723b0f39a..5a4859813 100644
--- a/inc/IXR_Library.php
+++ b/inc/IXR_Library.php
@@ -714,8 +714,9 @@ class IXR_IntrospectionServer extends IXR_Server {
$method = $this->callbacks[$methodname];
$signature = $this->signatures[$methodname];
$returnType = array_shift($signature);
- // Check the number of arguments
- if (count($args) != count($signature)) {
+ // Check the number of arguments. Check only, if the minimum count of parameters is specified. More parameters are possible.
+ // This is a hack to allow optional parameters...
+ if (count($args) < count($signature)) {
// print 'Num of args: '.count($args).' Num in signature: '.count($signature);
return new IXR_Error(-32602, 'server error. wrong number of method parameters');
}
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(){