summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorGina Haeussge <osd@foosel.net>2008-08-23 12:04:40 +0200
committerGina Haeussge <osd@foosel.net>2008-08-23 12:04:40 +0200
commitcfef30015aa05745995a8ff122b6f3e80f2167a3 (patch)
treeb7acdf604e1f501b8a1e21fa9a967558fc73c899 /lib/exe
parent20683e409709daf05e178a5f443e322b47dcaf99 (diff)
downloadrpg-cfef30015aa05745995a8ff122b6f3e80f2167a3.tar.gz
rpg-cfef30015aa05745995a8ff122b6f3e80f2167a3.tar.bz2
XMLRPC: Added method getAttachment for retrieving a media file from the wiki
darcs-hash:20080823100440-2b4f5-a134b64fe552e5151ac7adce0292e90b62d8c747.gz
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/xmlrpc.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index c10411de2..12b9fb68d 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -136,6 +136,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
array('struct', 'string', 'base64', 'struct'),
'Upload a file to the wiki.'
);
+ $this->addCallback(
+ 'wiki.getAttachment',
+ 'this:getAttachment',
+ array('string'),
+ 'Download a file from the wiki.'
+ );
$this->serve();
}
@@ -155,6 +161,22 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
return $text;
}
}
+
+ /**
+ * Return a media file encoded in base64
+ */
+ function getAttachment($id){
+ if (auth_quickaclcheck(getNS($id).':*') < AUTH_READ)
+ return new IXR_Error(1, 'You are not allowed to read this file');
+
+ $file = mediaFN($id);
+ if (!@ file_exists($file))
+ return new IXR_Error(1, 'The requested file does not exist');
+
+ $data = io_readFile($file, false);
+ $base64 = base64_encode($data);
+ return $base64;
+ }
/**
* Return a wiki page rendered to html