Use file common file listing.

This commit is contained in:
Michal Čihař
2005-09-27 19:07:36 +00:00
parent 22ddb6cee2
commit ec2ac82b89
3 changed files with 14 additions and 25 deletions

View File

@@ -10,14 +10,14 @@
* @param string regullar expression to match files
* @returns array sorted file list on success, FALSE on failure
*/
function PMA_getDirContent($dir, $expression) {
function PMA_getDirContent($dir, $expression = '') {
if ($handle = @opendir($dir)) {
$result = array();
if (substr($dir, -1) != '/') {
$dir .= '/';
}
while ($file = @readdir($handle)) {
if (is_file($dir . $file) && preg_match($expression, $file)) {
if (is_file($dir . $file) && ($expression == '' || preg_match($expression, $file))) {
$result[] = $file;
}
}
@@ -37,7 +37,7 @@ function PMA_getDirContent($dir, $expression) {
* @param string currently active choice
* @returns array sorted file list on success, FALSE on failure
*/
function PMA_getFileSelectOptions($dir, $extensions, $active = '') {
function PMA_getFileSelectOptions($dir, $extensions = '', $active = '') {
$list = PMA_getDirContent($dir, $extensions);
if ($list === FALSE) return FALSE;
$result = '';