summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/exe/xmlrpc.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index ee0ab52ed..24338da8b 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -4,6 +4,10 @@ if(!defined('DOKU_INC')) define('DOKU_INC',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);
+/**
+ * Increased whenever the API is changed
+ */
+define('DOKU_XMLRPC_API_VERSION',1);
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
@@ -33,6 +37,13 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
/* DokuWiki's own methods */
$this->addCallback(
+ 'dokuwiki.getXMLRPCAPIVersion',
+ 'this:getAPIVersion',
+ array('integer'),
+ 'Returns the XMLRPC API version.'
+ );
+
+ $this->addCallback(
'dokuwiki.getVersion',
'getVersion',
array('string'),
@@ -40,6 +51,13 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
);
$this->addCallback(
+ 'dokuwiki.login',
+ 'this:login',
+ array('integer','string','string'),
+ 'Tries to login with the given credentials and sets auth cookies.'
+ );
+
+ $this->addCallback(
'dokuwiki.getPagelist',
'this:readNamespace',
array('struct','string','struct'),
@@ -825,6 +843,21 @@ dbglog($data);
);
}
+ function getAPIVersion(){
+ return DOKU_XMLRPC_API_VERSION;
+ }
+
+ function login($user,$pass){
+ global $conf;
+ global $auth;
+ if(!$conf['useacl']) return 0;
+ if(!$auth) return 0;
+ if($auth->canDo('external')){
+ return $auth->trustExternal($user,$pass,false);
+ }else{
+ return auth_login($user,$pass,false,true);
+ }
+ }
}
$server = new dokuwiki_xmlrpc_server();