diff options
author | Michael Hamann <michael@content-space.de> | 2011-09-08 11:27:42 +0200 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2011-09-08 11:39:00 +0200 |
commit | fb46ebd87eb43d5cd9f67f353f6656d0e3a0b196 (patch) | |
tree | b89b580659168d8550dcca66fb0c303389b77aaf /inc/search.php | |
parent | aea34b5fe445064477d8ad0c98926db33a0d0851 (diff) | |
parent | cc2c0b9d6af82732ed79eeb85c22b7c3192a4e55 (diff) | |
download | rpg-fb46ebd87eb43d5cd9f67f353f6656d0e3a0b196.tar.gz rpg-fb46ebd87eb43d5cd9f67f353f6656d0e3a0b196.tar.bz2 |
Merge branch 'media-revisions'
This introduces a new media manager and media revisions to DokuWiki. The
changes have been implemented by Kate Arzamastseva and are the
result of a Google Summer of Code project, the official project page can
be found at
http://www.google-melange.com/gsoc/project/google/gsoc2011/kate/18001
Thanks to Kate for the work and Google for sponsoring it!
Diffstat (limited to 'inc/search.php')
-rw-r--r-- | inc/search.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/inc/search.php b/inc/search.php index bc7c35482..a26ae4808 100644 --- a/inc/search.php +++ b/inc/search.php @@ -21,9 +21,10 @@ if(!defined('DOKU_INC')) die('meh.'); * @param int $lvl Recursion Level * @author Andreas Gohr <andi@splitbrain.org> */ -function search(&$data,$base,$func,$opts,$dir='',$lvl=1){ +function search(&$data,$base,$func,$opts,$dir='',$lvl=1,$sort=false){ $dirs = array(); $files = array(); + $filepaths = array(); //read in directories and files $dh = @opendir($base.'/'.$dir); @@ -35,9 +36,14 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1){ continue; } $files[] = $dir.'/'.$file; + $filepaths[] = $base.'/'.$dir.'/'.$file; } closedir($dh); - sort($files); + if ($sort == 'date') { + @array_multisort(array_map('filemtime', $filepaths), SORT_NUMERIC, SORT_DESC, $files); + } else { + sort($files); + } sort($dirs); //give directories to userfunction then recurse |