diff --git a/main/coursecopy/create_backup.php b/main/coursecopy/create_backup.php index dbc340d552..0c157d1019 100644 --- a/main/coursecopy/create_backup.php +++ b/main/coursecopy/create_backup.php @@ -15,8 +15,11 @@ $language_file = array('exercice', 'admin', 'coursebackup'); // Including the global initialization file require_once '../inc/global.inc.php'; $current_course_tool = TOOL_COURSE_MAINTENANCE; + api_protect_course_script(true); +api_check_archive_dir(); + // Check access rights (only teachers are allowed here) if (!api_is_allowed_to_edit()) { api_not_allowed(true); @@ -48,6 +51,8 @@ require_once 'classes/CourseSelectForm.class.php'; // Display the tool title echo Display::page_header($nameTools); + + /* MAIN CODE */ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup')) { diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index f3d4f28d70..76144db355 100644 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -5794,7 +5794,7 @@ function api_resource_is_locked_by_gradebook($item_id, $link_type, $course_code * @param string course code * @return boolean */ -function block_course_item_locked_by_gradebook($item_id, $link_type, $course_code = null) { +function api_block_course_item_locked_by_gradebook($item_id, $link_type, $course_code = null) { if (api_is_platform_admin()) { return false; } @@ -5805,7 +5805,7 @@ function block_course_item_locked_by_gradebook($item_id, $link_type, $course_cod } } -function check_php_version($my_inc_path = null) { +function api_check_php_version($my_inc_path = null) { if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { $global_error_code = 1; // Incorrect PHP version @@ -5815,4 +5815,11 @@ function check_php_version($my_inc_path = null) { } exit; } +} + +function api_check_archive_dir() { + if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); + api_not_allowed(true, $message); + } } \ No newline at end of file