Example #1
0
            }
            if ($child->is_file()) {
                $files[] = $child;
            }
            if ($child->is_folder()) {
                $folders[] = $child;
            }
        }
    }
}
$folders = $requested_folders;
/**
 * Requested files may not be accessible.
 */
if (count($files) == 0) {
    Response::not_found();
}
$root_dir = '';
$items = array_merge($folders, $files);
foreach ($items as $item) {
    $path = $item->get_absolute_path();
    $path = realpath($path);
    $dir = dirname($path);
    if (empty($root_dir) || strlen($root_dir) > strlen($dir)) {
        $root_dir = $dir;
    }
}
/**
 * Zip files together.
 */
$temp_zip_path = Chamilo::temp_file('zip');