diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 670cdc1ae1..d54450f1e2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2010-07-08 Miguel de Dios + + * include/functions_filemanager.php: cleaned source code. And added function + "read_recursive_dir" to give a content of dir in a array. + + * include/functions_config.php: added $config['collection_max_size']. + 2010-07-08 Dario Rodriguez * operation/agentes/networkmap.php: fixed order in combo box of zoom diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index d22610bd35..bd093d8a41 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -310,6 +310,10 @@ function process_config () { if (!isset ($config["gis_purge"])){ update_config_value ('gis_purge', 7); } + + if (!isset ($config["collection_max_size"])){ + update_config_value ('collection_max_size', 1000000); + } /* *Parse the ACL IP list for access API that it's save in chunks as diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index f995ef3251..0702d6535b 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -346,8 +346,8 @@ function delete_directory($dir) { if ($handle = opendir($dir)) { - while (false !== ($file = readdir($handle))) { - if (($file != ".") && ($file != "..")) { + while (false !== ($file = readdir($handle))) { + if (($file != ".") && ($file != "..")) { if (is_dir($dir . $file)) { @@ -367,6 +367,44 @@ function delete_directory($dir) } } +/** + * Read a directory recursibly and return a array with the files with + * the absolute path and relative + * + * @param string $dir absoute dir to scan + * @param string $relative_path Relative path to scan, by default '' + * + * @return array The files in the dirs, empty array for empty dir of files. + */ +function read_recursive_dir($dir, $relative_path = '') { + $return = array(); + + if ($handle = opendir($dir)) + { + while (false !== ($entry = readdir($handle))) { + if (($entry != ".") && ($entry != "..")) { + +// debugPrint($entry); +// debugPrint($return); + + if (is_dir($dir . $entry)) + { +// debugPrint('dir'); + $return = array_merge($return, read_recursive_dir($dir . $entry . '/', $relative_path . $entry . '/' )); + } + else + { +// debugPrint('file'); + $return[] = array('relative' => $relative_path . $entry, 'absolute' => $dir . $entry); + } + } + } + closedir($handle); + } + + return $return; +} + /** * The main function to show the directories and files. *