summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-02-01 11:35:19 -0800
committerAndreas Gohr <andi@splitbrain.org>2012-02-01 11:35:19 -0800
commit1d667b4c1c191998288c0f0f377c453385f9ca57 (patch)
tree04de20a637bd451f5515a9776b84ee14b01cc448 /lib/exe
parent853bf105c0cfb04e7e984e2053e4b871606bd6f1 (diff)
parentaafb4e36f7fdc95d371cffcf351c3611efd69945 (diff)
downloadrpg-1d667b4c1c191998288c0f0f377c453385f9ca57.tar.gz
rpg-1d667b4c1c191998288c0f0f377c453385f9ca57.tar.bz2
Merge pull request #69 from timroes/master
Improbement and "bug"fixing of the xmlrpc interface
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/xmlrpc.php48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 95775188f..61e6f1e95 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,14 +304,14 @@ 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 = base64_encode($data);
+ $base64 = new IXR_Base64($data);
return $base64;
}
@@ -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)) {
@@ -575,7 +575,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
$auth = auth_quickaclcheck(getNS($id).':*');
if(!isset($id)) {
- return new IXR_ERROR(1, 'Filename not given.');
+ return new IXR_ERROR(231, 'Filename not given.');
}
global $conf;
@@ -611,11 +611,11 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
if ($res & DOKU_MEDIA_DELETED) {
return 0;
} elseif ($res & DOKU_MEDIA_NOT_AUTH) {
- return new IXR_ERROR(1, "You don't have permissions to delete files.");
+ return new IXR_ERROR(212, "You don't have permissions to delete files.");
} elseif ($res & DOKU_MEDIA_INUSE) {
- return new IXR_ERROR(1, 'File is still referenced');
+ return new IXR_ERROR(232, 'File is still referenced');
} else {
- return new IXR_ERROR(1, 'Could not delete file');
+ return new IXR_ERROR(233, 'Could not delete file');
}
}
@@ -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);