Code Duplication    Length = 17-17 lines in 2 locations

main/install/install.lib.php 1 location

@@ 440-456 (lines=17) @@
437
 * @param   string  $directory  Full path to a directory
438
 * @return  array   A list of files and dirs in the directory
439
 */
440
function my_directory_to_array($directory)
441
{
442
    $array_items = array();
443
    if ($handle = opendir($directory)) {
444
        while (false !== ($file = readdir($handle))) {
445
            if ($file != "." && $file != "..") {
446
                if (is_dir($directory. "/" . $file)) {
447
                    $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file));
448
                    $file = $directory . "/" . $file;
449
                    $array_items[] = preg_replace("/\/\//si", '/', $file);
450
                }
451
            }
452
        }
453
        closedir($handle);
454
    }
455
    return $array_items;
456
}
457
458
/**
459
 * This function returns the value of a parameter from the configuration file

main/work/work.lib.php 1 location

@@ 973-989 (lines=17) @@
970
 * @author  Julio Montoya
971
 * @version April 2008
972
 */
973
function directory_to_array($directory)
974
{
975
    $array_items = array();
976
    if ($handle = @opendir($directory)) {
977
        while (false !== ($file = readdir($handle))) {
978
            if ($file != '.' && $file != '..') {
979
                if (is_dir($directory. '/' . $file)) {
980
                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
981
                    $file = $directory . '/' . $file;
982
                    $array_items[] = preg_replace("/\/\//si", '/', $file);
983
                }
984
            }
985
        }
986
        closedir($handle);
987
    }
988
989
    return $array_items;
990
}
991
992
/**