From e61127e4af913a252fbe5c8f427501268501895c Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 19:31:10 +0100 Subject: refactored RemoteAccessDenied to RemoteAccessDeniedException --- _test/cases/inc/remote.test.php | 4 ++-- inc/RemoteAPICore.php | 18 +++++++++--------- inc/remote.php | 4 ++-- lib/exe/xmlrpc.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index c4f0cd2c2..f5da3c06d 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -290,7 +290,7 @@ class remote_test extends UnitTestCase { $conf['useacl'] = 1; $remoteApi = new RemoteApi(); $remoteApi->getCoreMethods(new RemoteAPICoreTest()); - $this->expectException('RemoteAccessDenied'); + $this->expectException('RemoteAccessDeniedException'); $remoteApi->call('wiki.stringTestMethod'); } @@ -298,7 +298,7 @@ class remote_test extends UnitTestCase { global $conf; $conf['useacl'] = 1; $remoteApi = new RemoteApi(); - $this->expectException('RemoteAccessDenied'); + $this->expectException('RemoteAccessDeniedException'); $remoteApi->call('plugin.testplugin.methodString'); } diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 639aa4536..2fecc3032 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -194,7 +194,7 @@ class RemoteAPICore { function rawPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } $text = rawWiki($id,$rev); if(!$text) { @@ -214,7 +214,7 @@ class RemoteAPICore { function getAttachment($id){ $id = cleanID($id); if (auth_quickaclcheck(getNS($id).':*') < AUTH_READ) { - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } $file = mediaFN($id); @@ -253,7 +253,7 @@ class RemoteAPICore { function htmlPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } return p_wiki_xhtml($id,$rev,false); } @@ -372,7 +372,7 @@ class RemoteAPICore { } return $data; } else { - throw new RemoteAccessDenied(1, 'You are not allowed to list media files.'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to list media files.'); } } @@ -389,7 +389,7 @@ class RemoteAPICore { function pageInfo($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } $file = wikiFN($id,$rev); $time = @filemtime($file); @@ -432,7 +432,7 @@ class RemoteAPICore { } if(auth_quickaclcheck($id) < AUTH_EDIT) { - throw new RemoteAccessDenied(1, 'You are not allowed to edit this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to edit this page'); } // Check, if page is locked @@ -519,7 +519,7 @@ class RemoteAPICore { if ($res & DOKU_MEDIA_DELETED) { return 0; } elseif ($res & DOKU_MEDIA_NOT_AUTH) { - throw new RemoteAccessDenied(1, "You don't have permissions to delete files."); + throw new RemoteAccessDeniedException(1, "You don't have permissions to delete files."); } elseif ($res & DOKU_MEDIA_INUSE) { throw new RemoteException(1, 'File is still referenced'); } else { @@ -543,7 +543,7 @@ class RemoteAPICore { function listLinks($id) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } $links = array(); @@ -659,7 +659,7 @@ class RemoteAPICore { function pageVersions($id, $first) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ) { - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } global $conf; diff --git a/inc/remote.php b/inc/remote.php index 71ceb97b5..8c505911c 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -4,7 +4,7 @@ if (!defined('DOKU_INC')) die(); require_once(DOKU_INC.'inc/RemoteAPICore.php'); class RemoteException extends Exception {} -class RemoteAccessDenied extends RemoteException {} +class RemoteAccessDeniedException extends RemoteException {} abstract class RemoteDataType { private $value; @@ -161,7 +161,7 @@ class RemoteAPI { */ public function forceAccess() { if (!$this->hasAccess()) { - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } } diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 44b4ba7a0..ce9ef1484 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -37,7 +37,7 @@ class dokuwiki_xmlrpc_server extends IXR_Server { //print 'a'; $result = $this->remote->call($methodname, $args); return $result; - } catch (RemoteAccessDenied $e) { + } catch (RemoteAccessDeniedException $e) { if (!isset($_SERVER['REMOTE_USER'])) { header('HTTP/1.1 401 Unauthorized'); } else { -- cgit v1.2.3