diff options
author | Tim Roes <mail@timroes.de> | 2011-11-29 19:17:59 +0100 |
---|---|---|
committer | Tim Roes <mail@timroes.de> | 2011-11-29 19:17:59 +0100 |
commit | 1c122589394bb9150f09facdcd6e75d054eb69a4 (patch) | |
tree | 49e83742f41c4b30217b50542d9fd3241a49e804 /lib/exe/xmlrpc.php | |
parent | 5505dd9afd380c1676d9d0cef3e10d5be06ffee2 (diff) | |
download | rpg-1c122589394bb9150f09facdcd6e75d054eb69a4.tar.gz rpg-1c122589394bb9150f09facdcd6e75d054eb69a4.tar.bz2 |
Using sensefull error codes.
Since there are currently a lot of error coded returning 1, that mean
completly different thing, i guess it would be very nice to change this.
A client should not be forced to parse the error message, the error code
should be enough to explain the error.
This change suggests some error codes, that have a hierarchical
structure. In the following list the categories begin with = and the
error codes actually used with -.
= 100 Page errors
== 110 Page access errors
--- 111 User is not allowed to read the requested page
--- 112 User is not allowed to edit the page
== 120 Page existance errors
--- 121 The requested page does not exist
== 130 Page edit errors
--- 131 Empty page id
--- 132 Empty page content
--- 133 Page is locked
--- 134 Positive wordblock check
= 200 Media errors
== 210 Media access errors
--- 211 User is not allowed to read media
--- 215 User is not allowed to list media
== 220 Media existance errors
--- 221 The requested media does not exist
= 300 Search errors
== 310 Argument errors
--- 311 The provided value is not a valid timestamp
== 320 Search result errors
--- 321 No chances in specified timeframe
Diffstat (limited to 'lib/exe/xmlrpc.php')
-rw-r--r-- | lib/exe/xmlrpc.php | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 3a05c886d..5d19725a3 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -286,7 +286,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function rawPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); + return new IXR_Error(111, 'You are not allowed to read this page'); } $text = rawWiki($id,$rev); if(!$text) { @@ -304,11 +304,11 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { 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'); + return new IXR_Error(211, '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'); + return new IXR_Error(221, 'The requested file does not exist'); $data = io_readFile($file, false); $base64 = new IXR_Base64($data); @@ -342,7 +342,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function htmlPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); + return new IXR_Error(111, 'You are not allowed to read this page'); } return p_wiki_xhtml($id,$rev,false); } @@ -462,7 +462,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { } return $data; } else { - return new IXR_Error(1, 'You are not allowed to list media files.'); + return new IXR_Error(215, 'You are not allowed to list media files.'); } } @@ -479,12 +479,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function pageInfo($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); + return new IXR_Error(111, 'You are not allowed to read this page'); } $file = wikiFN($id,$rev); $time = @filemtime($file); if(!$time){ - return new IXR_Error(10, 'The requested page does not exist'); + return new IXR_Error(121, 'The requested page does not exist'); } $info = getRevisionInfo($id, $time, 1024); @@ -515,22 +515,22 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { $minor = $params['minor']; if(empty($id)) - return new IXR_Error(1, 'Empty page ID'); + return new IXR_Error(131, 'Empty page ID'); if(!page_exists($id) && trim($TEXT) == '' ) { - return new IXR_ERROR(1, 'Refusing to write an empty new wiki page'); + return new IXR_ERROR(132, 'Refusing to write an empty new wiki page'); } if(auth_quickaclcheck($id) < AUTH_EDIT) - return new IXR_Error(1, 'You are not allowed to edit this page'); + return new IXR_Error(112, 'You are not allowed to edit this page'); // Check, if page is locked if(checklock($id)) - return new IXR_Error(1, 'The page is currently locked'); + return new IXR_Error(133, 'The page is currently locked'); // SPAM check if(checkwordblock()) - return new IXR_Error(1, 'Positive wordblock check'); + return new IXR_Error(134, 'Positive wordblock check'); // autoset summary on new pages if(!page_exists($id) && empty($sum)) { @@ -635,7 +635,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function listLinks($id) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); + return new IXR_Error(111, 'You are not allowed to read this page'); } $links = array(); @@ -684,7 +684,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { */ function getRecentChanges($timestamp) { if(strlen($timestamp) != 10) - return new IXR_Error(20, 'The provided value is not a valid timestamp'); + return new IXR_Error(311, 'The provided value is not a valid timestamp'); $recents = getRecentsSince($timestamp); @@ -705,7 +705,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { return $changes; } else { // in case we still have nothing at this point - return new IXR_Error(30, 'There are no changes in the specified timeframe'); + return new IXR_Error(321, 'There are no changes in the specified timeframe'); } } @@ -717,7 +717,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { */ function getRecentMediaChanges($timestamp) { if(strlen($timestamp) != 10) - return new IXR_Error(20, 'The provided value is not a valid timestamp'); + return new IXR_Error(311, 'The provided value is not a valid timestamp'); $recents = getRecentsSince($timestamp, null, '', RECENTS_MEDIA_CHANGES); @@ -738,7 +738,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { return $changes; } else { // in case we still have nothing at this point - return new IXR_Error(30, 'There are no changes in the specified timeframe'); + return new IXR_Error(321, 'There are no changes in the specified timeframe'); } } @@ -750,14 +750,14 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function pageVersions($id, $first) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); + return new IXR_Error(111, 'You are not allowed to read this page'); } global $conf; $versions = array(); if(empty($id)) - return new IXR_Error(1, 'Empty page ID'); + return new IXR_Error(131, 'Empty page ID'); $revisions = getRevisions($id, $first, $conf['recent']+1); |