function convert_dir_list($topdir)
{
    global $config;
    if (!is_dir($topdir)) {
        return;
    }
    $imspector_config = $config['installedpackages']['imspector']['config'][0];
    $limit = preg_match("/\\d+/", $imspector_config['reportlimit']) ? $imspector_config['reportlimit'] : "50";
    $count = 0;
    if ($dh = opendir($topdir)) {
        while (($file = readdir($dh)) !== false) {
            if (!preg_match('/^\\./', $file) == 0) {
                continue;
            }
            if (is_dir("{$topdir}/{$file}")) {
                $list .= convert_dir_list("{$topdir}/{$file}");
            } else {
                $list .= "{$topdir}/{$file}\n";
            }
            $count++;
            if ($count >= $limit) {
                closedir($dh);
                return $list;
            }
        }
        closedir($dh);
    }
    return $list;
}
function convert_dir_list($topdir)
{
    if (!is_dir($topdir)) {
        return;
    }
    if ($dh = opendir($topdir)) {
        while (($file = readdir($dh)) !== false) {
            if (!preg_match('/^\\./', $file) == 0) {
                continue;
            }
            if (is_dir("{$topdir}/{$file}")) {
                $list .= convert_dir_list("{$topdir}/{$file}");
            } else {
                $list .= "{$topdir}/{$file}\n";
            }
        }
        closedir($dh);
    }
    return $list;
}