From 499c7d276a86050755177293451fd660ffd96dd7 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 May 2013 17:40:50 +0200 Subject: [PATCH] Setting course in order to be used in the script --- main/document/create_document.php | 3 ++- main/document/upload.php | 2 +- main/inc/lib/document.lib.php | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main/document/create_document.php b/main/document/create_document.php index 8addea4b9c..1e8f228613 100644 --- a/main/document/create_document.php +++ b/main/document/create_document.php @@ -160,6 +160,7 @@ require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; //I'm in the certification module? $is_certificate_mode = false; +$_course = api_get_course_info(); if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') { $is_certificate_mode = true; @@ -753,4 +754,4 @@ if ($form->validate()) { '; Display :: display_footer(); -} \ No newline at end of file +} diff --git a/main/document/upload.php b/main/document/upload.php index cb3c22646c..82d784eeaa 100644 --- a/main/document/upload.php +++ b/main/document/upload.php @@ -101,7 +101,7 @@ $(function () { // Variables $is_allowed_to_edit = api_is_allowed_to_edit(null, true); - +$_course = api_get_course_info(); $courseDir = $_course['path'].'/document'; $sys_course_path = api_get_path(SYS_COURSE_PATH); $base_work_dir = $sys_course_path.$courseDir; diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index e9ccb04498..519b3a4340 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -652,6 +652,10 @@ class DocumentManager $to_group_id = intval($to_group_id); + if (empty($_course)) { + return false; + } + if ($can_see_invisible) { //condition for the session $session_id = api_get_session_id();