diff options
author | Dominik Eckelmann <deckelmann@gmail.com> | 2011-12-11 11:24:19 +0100 |
---|---|---|
committer | Dominik Eckelmann <deckelmann@gmail.com> | 2011-12-22 19:07:33 +0100 |
commit | fe092d886946cca23fa8ab1be240a356a1f60492 (patch) | |
tree | 8172bd7430345e4a4cce4b4d07a38d5779bc22cb /lib/exe/xmlrpc.php | |
parent | add86630b09f0e91952081112e3fa642ee35e499 (diff) | |
download | rpg-fe092d886946cca23fa8ab1be240a356a1f60492.tar.gz rpg-fe092d886946cca23fa8ab1be240a356a1f60492.tar.bz2 |
transfered bugfix from dokuwiki 97a000f0551735b35606d94d59abc4ff440783a5
Diffstat (limited to 'lib/exe/xmlrpc.php')
-rw-r--r-- | lib/exe/xmlrpc.php | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index cb8dbf42d..bcbae0a43 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -299,17 +299,16 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * @author Gina Haeussge <osd@foosel.net> */ function getAttachment($id){ - $id = cleanID($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; + try { + try { + return $this->remote->getAttachment($id); + } catch (RemoteAccessDenied $e) { + return new IXR_Error(1, 'You are not allowed to read this file'); + } + } + catch (RemoteException $e) { + return new IXR_Error(1, $e->getMessage()); + } } /** @@ -318,18 +317,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * @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); - } - + $info = $this->remote->getAttachmentInfo($id); + $info['lastModified'] = new IXR_Date($info['lastModified']); return $info; } |