slitaz-forge rev 282
dir-generator.php: fix file filter
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 14 16:31:50 2012 +0200 (2012-04-14) |
parents | 0c60de3b50be |
children | 79bd3f57e8c5 |
files | mirror/root/dir-generator.php |
line diff
1.1 --- a/mirror/root/dir-generator.php Sat Apr 14 15:54:07 2012 +0200 1.2 +++ b/mirror/root/dir-generator.php Sat Apr 14 16:31:50 2012 +0200 1.3 @@ -328,12 +328,6 @@ 1.4 if ($item == ".folderlist") continue; 1.5 if ($item == ".filelist") continue; 1.6 if ($item == "dir-generator.php") continue; 1.7 - if (isset($_GET['f'])) { 1.8 - $filter = $_GET['f']; 1.9 - if (substr($filter,0,1) != '/') 1.10 - $filter = '/'.$filter.'/i'; 1.11 - if (!preg_match($filter,$item)) continue; 1.12 - } 1.13 if(is_dir($path.'/'.$item) and $item != '.' and $item != '..') { 1.14 $folderlist[] = array( 1.15 'name' => $item, 1.16 @@ -364,6 +358,17 @@ 1.17 } 1.18 } 1.19 1.20 +if (isset($_GET['f'])) { 1.21 + $filter = $_GET['f']; 1.22 + if (substr($filter,0,1) != '/') 1.23 + $filter = '/'.$filter.'/i'; 1.24 + foreach ($filelist as $key => $value) 1.25 + if (!preg_match($filter,$value['name'])) 1.26 + unset($filelist[$key]); 1.27 + foreach ($folderlist as $key => $value) 1.28 + if (!preg_match($filter,$value['name'])) 1.29 + unset($folderlist[$key]); 1.30 +} 1.31 1.32 if(!isset($_GET['s'])) { 1.33 $_GET['s'] = 'name';