$curr_dir_pos = $key; } } } if (!sizeof($dirs)) { $error_msg = $lang->m('error_no_directory_available', 'spawfm'); } // set first directory as selected if selected directory is not valid if ($spawfm->getCurrentDirData() === false and sizeof($dirs)) { $keys = array_keys($dirs); $curr_dir_pos = $keys[0]; $curr_dir = $dirs[$curr_dir_pos]['dir']; $spawfm->setCurrentDirData($dirs[$curr_dir_pos]); } // process subdirectories if selected and allowed if ($spawfm->getCurrentDirSetting('recursive') and !empty($curr_dir_subdir)) { // filter subdir variable for validity $arr = explode('/', $curr_dir_subdir); $str = ''; foreach ($arr as $val) { if (!empty($val) and $val != '..') { $str .= $val . '/'; } } $curr_dir_subdir = $str; // add subdirectories to list if exist and parent dir matched if ($spawfm->getCurrentFsDir() and file_exists($spawfm->getCurrentFsDir() . $curr_dir_subdir)) { $dirs_new = array(); foreach ($dirs as $pos => $dir) { $dirs_new[] = $dir; if ($pos == $curr_dir_pos and preg_match_all('|([^/]*)/|', $curr_dir_subdir, $subdirs)) {
$curr_dir_pos = $key; } } } if (!sizeof($dirs)) { $error_msg = $lang->m('error_no_directory_available', 'spawfm'); } // set first directory as selected if selected directory is not valid if ($spawfm->getCurrentDirData() === false and sizeof($dirs)) { $keys = array_keys($dirs); $curr_dir_pos = $keys[0]; $curr_dir = $dirs[$curr_dir_pos]['dir']; $spawfm->setCurrentDirData($dirs[$curr_dir_pos]); } // process subdirectories if selected and allowed if ($spawfm->getCurrentDirSetting('recursive') and !empty($curr_dir_subdir)) { // filter subdir variable for validity $arr = explode('/', $curr_dir_subdir); $str = ''; foreach ($arr as $val) { if (!empty($val) and $val != '..') { $str .= $val . '/'; } } $curr_dir_subdir = $str; // add subdirectories to list if exist and parent dir matched if ($spawfm->getCurrentFsDir() and file_exists($spawfm->getCurrentFsDir() . $curr_dir_subdir)) { $dirs_new = array(); foreach ($dirs as $pos => $dir) { $dirs_new[] = $dir; if ($pos == $curr_dir_pos and preg_match_all('|([^/]*)/|', $curr_dir_subdir, $subdirs)) {