From 00e3e3940de140e6fe6ce3c558c71a47f676b456 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 3 Aug 2013 17:17:58 +0200 Subject: fix the default ordering of media files to be "natural". also allow the order to be specified in more places. --- inc/media.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'inc/media.php') 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 * @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); } -- cgit v1.2.3