diff --git a/main/document/document.php b/main/document/document.php index ea93614797..e8211d4989 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -75,9 +75,6 @@ $courseInfo = api_get_course_info(); $courseId = $courseInfo['real_id']; $course_dir = $courseInfo['directory'].'/document'; $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true'; -$sys_course_path = api_get_path(SYS_COURSE_PATH); -$base_work_dir = $sys_course_path.$course_dir; -$document_path = $base_work_dir; $currentUrl = api_get_self().'?'.api_get_cidreq(); // I'm in the certification module? @@ -275,7 +272,7 @@ switch ($action) { $deleteDocument = DocumentManager::delete_document( $courseInfo, null, - $base_work_dir, + '', $sessionId, $_GET['deleteid'], $groupIid @@ -351,21 +348,6 @@ switch ($action) { $url = $publicPath."courses/$courseCode/document$path"; header("Location: $url"); exit; - - // Check visibility of document and paths - if (!($isAllowedToEdit || $groupMemberWithUploadRights) && - !DocumentManager::is_visible_by_id($document_id, $courseInfo, $sessionId, api_get_user_id()) - ) { - api_not_allowed(true); - } - $full_file_name = $base_work_dir.$document_data['path']; - if (Security::check_abs_path($full_file_name, $base_work_dir.'/')) { - $result = DocumentManager::file_send_for_download($full_file_name, true); - if ($result === false) { - api_not_allowed(true); - } - } - exit; break; case 'downloadfolder': if (api_get_setting('students_download_folders') == 'true' || $isAllowedToEdit) { @@ -422,6 +404,7 @@ switch ($action) { } break; case 'copytomyfiles': + break; // Copy a file to general my files user's if (api_get_setting('allow_my_files') == 'true' && api_get_setting('users_copy_files') == 'true' && @@ -524,6 +507,7 @@ switch ($action) { } break; case 'convertToPdf': + break; // PDF format as target by default $formatTarget = $_REQUEST['formatTarget'] ? strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) @@ -606,6 +590,7 @@ if (isset($document_id) && empty($action)) { true, $sessionId ); + if ($sessionId != 0 && !$document_data) { // If there is a session defined and asking for the // document * from the session* didn't work, try it from the course @@ -617,6 +602,8 @@ if (isset($document_id) && empty($action)) { 0 ); } + + //var_dump($document_data); exit; // If the document is not a folder we show the document. if ($document_data) { @@ -1087,7 +1074,6 @@ if ($isAllowedToEdit || $groupMemberWithUploadRights || // Security fix: make sure they can't move files that are not in the document table if (!empty($document_to_move)) { if ($document_to_move['filetype'] === 'link') { - $real_path_target = $base_work_dir.$moveTo.'/'; if (!DocumentManager::cloudLinkExists($_course, $moveTo, $document_to_move['comment'])) { DocumentManager::updateDbInfo( 'update', @@ -1225,7 +1211,7 @@ if ($isAllowedToEdit || $deleteDocument = DocumentManager::delete_document( $courseInfo, null, - $base_work_dir, + '', $sessionId, $documentId, $groupIid @@ -1300,7 +1286,6 @@ if ($isAllowedToEdit || $added_slash = $curdirpath == '/' ? '' : '/'; $dir_name = $curdirpath.$added_slash.api_replace_dangerous_char($post_dir_name); $dir_name = disable_dangerous_file($dir_name); - $dir_check = $base_work_dir.$dir_name; $visibility = empty($groupId) ? null : 1; $newFolderData = create_unexisting_directory( @@ -1309,7 +1294,7 @@ if ($isAllowedToEdit || $sessionId, api_get_group_id(), $to_user_id, - $base_work_dir, + '', $dir_name, $post_dir_name, $visibility, diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index 05f6f1655e..870b5432ce 100755 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -916,7 +916,7 @@ class GradebookTable extends SortableTable $content_html = DocumentManager::replace_user_info_into_html( api_get_user_id(), - $course_code, + api_get_course_info($course_code), api_get_session_id() ); diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index fd9fd6d111..6b46436533 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -2065,8 +2065,6 @@ function api_get_course_info($course_code = null) $courseInfo = api_format_course_array($course); - Session::write('_course', $courseInfo); - return $courseInfo; } @@ -2220,8 +2218,7 @@ function api_format_course_array(Course $course) $courseData['code'] = $courseData['sysCode'] = $course->getCode(); $courseData['name'] = $courseData['title'] = $course->getTitle(); $courseData['official_code'] = $courseData['visual_code'] = $course->getVisualCode(); - //$courseData['path'] = $course_data['directory']; // Use as key in path. - //$courseData['directory'] = $course_data['directory']; + $courseData['path'] = $courseData['directory'] = $course->getDirectory(); // Use as key in path. $courseData['creation_date'] = $course->getCreationDate()->format('Y-m-d H:i:s'); $courseData['titular'] = $course->getTutorName(); $courseData['language'] = $courseData['course_language'] = $course->getCourseLanguage(); diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 0c94c4518b..651b8a1ed6 100644 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -4287,11 +4287,11 @@ class DocumentManager $fileName = api_replace_dangerous_char($title); $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['directory']}/document$dir"; - if (!is_dir($filePath)) { + /*if (!is_dir($filePath)) { mkdir($filePath, api_get_permissions_for_new_directories()); - } + }*/ - $fileFullPath = "$filePath/$fileName.html"; + //$fileFullPath = "$filePath/$fileName.html"; $fileType = 'file'; $templateContent = file_get_contents(api_get_path(SYS_CODE_PATH).'gradebook/certificate_template/template.html'); @@ -4694,6 +4694,9 @@ class DocumentManager if (is_array($folders)) { foreach ($folders as $folder_id => &$folder) { + if (!isset($folder_titles[$folder])) { + continue; + } $selected = ($document_id == $folder_id) ? ' selected="selected"' : ''; $path_parts = explode('/', $folder); $folder_titles[$folder] = cut($folder_titles[$folder], 80); @@ -6349,6 +6352,7 @@ This folder contains all sessions that have been opened in the chat. Although th $session = api_get_session_entity($sessionId); $group = api_get_group_entity($groupId); $readonly = (int) $readonly; + $fileSize = (int) $fileSize; $documentRepo = Container::getDocumentRepository(); $parentNode = $courseEntity; diff --git a/src/CoreBundle/Repository/IllustrationRepository.php b/src/CoreBundle/Repository/IllustrationRepository.php index 12b5bcbce0..2bc564956a 100644 --- a/src/CoreBundle/Repository/IllustrationRepository.php +++ b/src/CoreBundle/Repository/IllustrationRepository.php @@ -31,7 +31,7 @@ class IllustrationRepository extends ResourceRepository $illustration = new Illustration(); $em->persist($illustration); $illustrationNode = $this->addResourceNode($illustration, $user, $resource); - $this->addResourceToEveryone($illustrationNode); + //$this->addResourceToEveryone($illustrationNode); } return $this->addFile($illustrationNode, $uploadFile); }