From fe092d886946cca23fa8ab1be240a356a1f60492 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 11 Dec 2011 11:24:19 +0100 Subject: transfered bugfix from dokuwiki 97a000f0551735b35606d94d59abc4ff440783a5 --- lib/exe/xmlrpc.php | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'lib') 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 */ 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 */ 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; } -- cgit v1.2.3