diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index 44f27853de..1a1f8aa488 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -349,15 +349,17 @@ function handle_stylesheets() } if (isset($_POST['download'])) { $arch = api_get_path(SYS_ARCHIVE_PATH).$safe_style_dir.'.zip'; - $dir = api_get_path(SYS_CODE_PATH).'css/'.$safe_style_dir; + $dir = api_get_path(SYS_CSS_PATH).'themes/'.$safe_style_dir; if (is_dir($dir)) { $zip = new PclZip($arch); // Remove path prefix except the style name and put file on disk $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir,0,-strlen($safe_style_dir))); + //@TODO: use more generic script to download. + $str = ''.get_lang('ClickHereToDownloadTheFile').''; + Display::display_normal_message($str, false); + } else { + Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); } - //@TODO: use more generic script to download. - $str = ''.get_lang('ClickHereToDownloadTheFile').''; - Display::display_normal_message($str,false); } } diff --git a/main/course_info/download.php b/main/course_info/download.php index 4037df371a..fbfc4bfddb 100755 --- a/main/course_info/download.php +++ b/main/course_info/download.php @@ -40,14 +40,7 @@ if (empty($content_type)) { } if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) { - header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); - header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - header('Cache-Control: public'); - header('Pragma: no-cache'); - header('Content-Type: '.$content_type); - header('Content-Length: '.filesize($archive_path.$archive_file)); - header('Content-Disposition: attachment; filename='.$archive_file); - readfile($archive_path.$archive_file); + DocumentManager::file_send_for_download($archive_path.$archive_file, true, $archive_file); exit; } else { api_not_allowed(true);