summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/media.php13
-rw-r--r--inc/template.php4
-rw-r--r--lib/exe/ajax.php3
3 files changed, 8 insertions, 12 deletions
diff --git a/inc/media.php b/inc/media.php
index a182ecb33..a9f6be771 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -1296,7 +1296,7 @@ function media_restore($image, $rev, $auth){
* @author Kate Arzamastseva <pshns@ukr.net>
* @triggers MEDIA_SEARCH
*/
-function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){
+function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural'){
global $conf;
global $lang;
@@ -1316,15 +1316,10 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){
$conf['mediadir'],
'search_media',
array('showmsg'=>false,'pattern'=>$pattern),
- $dir);
+ $dir,
+ 1,
+ $sort);
}
-
- $data = array();
- foreach ($evdata['data'] as $k => $v) {
- $data[$k] = ($sort == 'date') ? $v['mtime'] : $v['id'];
- }
- array_multisort($data, SORT_DESC, SORT_NUMERIC, $evdata['data']);
-
$evt->advise_after();
unset($evt);
}
diff --git a/inc/template.php b/inc/template.php
index ca1c8d9d5..c8520dc26 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1229,7 +1229,7 @@ function tpl_localeFN($id) {
* @param bool $fromajax - set true when calling this function via ajax
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function tpl_mediaContent($fromajax = false) {
+function tpl_mediaContent($fromajax = false, $sort='natural') {
global $IMG;
global $AUTH;
global $INUSE;
@@ -1259,7 +1259,7 @@ function tpl_mediaContent($fromajax = false) {
if($do == 'filesinuse') {
media_filesinuse($INUSE, $IMG);
} elseif($do == 'filelist') {
- media_filelist($NS, $AUTH, $JUMPTO);
+ media_filelist($NS, $AUTH, $JUMPTO,false,$sort);
} elseif($do == 'searchlist') {
media_searchlist($INPUT->str('q'), $NS, $AUTH);
} else {
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php
index 9769503a7..6e2011cd9 100644
--- a/lib/exe/ajax.php
+++ b/lib/exe/ajax.php
@@ -219,10 +219,11 @@ function ajax_medialist(){
global $INPUT;
$NS = cleanID($INPUT->post->str('ns'));
+ $sort = $INPUT->post->bool('recent') ? 'date' : 'natural';
if ($INPUT->post->str('do') == 'media') {
tpl_mediaFileList();
} else {
- tpl_mediaContent(true);
+ tpl_mediaContent(true, $sort);
}
}