summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorGina Haeussge <osd@foosel.net>2008-08-23 16:06:22 +0200
committerGina Haeussge <osd@foosel.net>2008-08-23 16:06:22 +0200
commit5672e868b61109a6a4376636618f3c48c37751fa (patch)
treed2a32c0ac43dd6cd83559e5da1e4cfcb4f1c8556 /lib/exe
parentb1cfa67e6346f1a1e7822e689d3855ba8c83066a (diff)
downloadrpg-5672e868b61109a6a4376636618f3c48c37751fa.tar.gz
rpg-5672e868b61109a6a4376636618f3c48c37751fa.tar.bz2
XMLRPC: Added getAttachmentInfo
darcs-hash:20080823140622-2b4f5-cb7dbe63f0142fedf39fdb5cfd1abedb10a6fa56.gz
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/xmlrpc.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 565da39c5..0f364ab6f 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -142,6 +142,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
array('string'),
'Download a file from the wiki.'
);
+ $this->addCallback(
+ 'wiki.getAttachmentInfo',
+ 'this:getAttachmentInfo',
+ array('string'),
+ 'Returns a struct with infos about the attachment.'
+ );
$this->serve();
}
@@ -177,6 +183,27 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
$base64 = base64_encode($data);
return $base64;
}
+
+ /**
+ * Return info about a media file
+ *
+ * @author Gina Haeussge <osd@foosel.net>
+ */
+ function getAttachmentInfo($id){
+ $id = cleanID($id);
+ $info = array(
+ 'lastModified' => 0,
+ 'size' => 0,
+ );
+
+ $file = mediaFN($id);
+ if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){
+ $info['lastModified'] = new IXR_Date(filemtime($file));
+ $info['size'] = filesize($file);
+ }
+
+ return $info;
+ }
/**
* Return a wiki page rendered to html