summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-02-23 18:27:46 +0100
committerAndreas Gohr <andi@splitbrain.org>2009-02-23 18:27:46 +0100
commit224122cf976599e1fc256224095d84c4e0827e1a (patch)
tree0979e26685dd2a962c88665c3c9dbe8b5d6aa0e2 /lib
parentef47e2988384a280584ec93d3e302dd48743db50 (diff)
downloadrpg-224122cf976599e1fc256224095d84c4e0827e1a.tar.gz
rpg-224122cf976599e1fc256224095d84c4e0827e1a.tar.bz2
streamlined media listing
Some parameters of media_search where changed, parts using this function need to be identified and fixed. darcs-hash:20090223172746-7ad00-d07951739fba17d0c8925b28b947f7cbb7fc7e1a.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/exe/xmlrpc.php32
1 files changed, 9 insertions, 23 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 351b039e9..4bdd78c45 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -330,35 +330,21 @@ dbglog($data);
if (!is_array($options))
$options = array();
- if (!isset($options['recursive'])) $options['recursive'] = false;
if(auth_quickaclcheck($ns.':*') >= AUTH_READ) {
$dir = utf8_encodeFN(str_replace(':', '/', $ns));
$data = array();
require_once(DOKU_INC.'inc/search.php');
- search($data, $conf['mediadir'], 'search_media', array('recursive' => $options['recursive']), $dir);
+ search($data, $conf['mediadir'], 'search_media', $options, $dir);
+ $len = count($data);
+ if(!$len) return array();
- if(!count($data)) {
- return array();
+ for($i=0; $i<$len; $i++) {
+ unset($data[$i]['meta']);
+ $data[$i]['lastModified'] = new IXR_Date($data[$i]['mtime']);
}
-
- $files = array();
- foreach($data as $item) {
- if (isset($options['pattern']) && !@preg_match($options['pattern'], $item['id']))
- continue;
- $file = array();
- $file['id'] = $item['id'];
- $file['size'] = $item['size'];
- $file['lastModified'] = new IXR_Date($item['mtime']);
- $file['isimg'] = $item['isimg'];
- $file['writable'] = $item['writeable'];
- $file['perms'] = auth_quickaclcheck(getNS($item['id']).':*');
- array_push($files, $file);
- }
-
- return $files;
-
+ return $data;
} else {
return new IXR_Error(1, 'You are not allowed to list media files.');
}
@@ -511,13 +497,13 @@ dbglog($data);
//check for overwrite
$overwrite = @file_exists($fn);
if($overwrite && (!$params['ow'] || $auth < AUTH_DELETE)) {
- return new IXR_ERROR(1, $lang['uploadexist']);
+ return new IXR_ERROR(1, $lang['uploadexist'].'1');
}
// check for valid content
@require_once(DOKU_INC.'inc/media.php');
$ok = media_contentcheck($ftmp, $imime);
if($ok == -1) {
- return new IXR_ERROR(1, sprintf($lang['uploadexist'], ".$iext"));
+ return new IXR_ERROR(1, sprintf($lang['uploadexist'].'2', ".$iext"));
} elseif($ok == -2) {
return new IXR_ERROR(1, $lang['uploadspam']);
} elseif($ok == -3) {