From ce8c11cdb33b964cb52667cd740ada645c2fe6e0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 24 Jun 2021 10:02:13 +0200 Subject: [PATCH] Remove/Comment unused code --- public/main/course_info/download.php | 6 +- public/main/inc/ajax/lp.ajax.php | 4 +- .../main/inc/ajax/record_audio_rtc.ajax.php | 4 +- public/main/inc/lib/MoodleImport.php | 8 +- public/main/inc/lib/document.lib.php | 153 ------------------ public/main/lp/learnpathItem.class.php | 5 +- public/main/lp/lp_admin_view.php | 6 +- .../plugin/courselegal/CourseLegalPlugin.php | 5 +- public/plugin/zoom/lib/ZoomPlugin.php | 5 +- 9 files changed, 25 insertions(+), 171 deletions(-) diff --git a/public/main/course_info/download.php b/public/main/course_info/download.php index 97b33f270a..3f3e2c39ce 100644 --- a/public/main/course_info/download.php +++ b/public/main/course_info/download.php @@ -1,6 +1,9 @@ find($documentId); - - if (empty($document)) { - return false; - } - - $filePath = $repo->getDocumentPath($documentId); - - if (empty($filePath)) { - return false; - } - - $title = $document->getTitle(); - //$filePath = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path']; - $pageFormat = 'A4'; - $pdfOrientation = 'P'; - if ('landscape' === $orientation) { - $pageFormat = 'A4-L'; - $pdfOrientation = 'L'; - } - - $pdf = new PDF( - $pageFormat, - $pdfOrientation, - $showHeaderAndFooter ? [] : ['top' => 0, 'left' => 0, 'bottom' => 0, 'right' => 0] - ); - - if (api_get_configuration_value('use_alternative_document_pdf_footer')) { - $view = new Template('', false, false, false, true, false, false); - $template = $view->get_template('export/alt_pdf_footer.tpl'); - - $pdf->set_custom_footer([ - 'html' => $view->fetch($template), - ]); - } - - $pdf->html_to_pdf( - $filePath, - $title, - $courseCode, - false, - $showHeaderAndFooter - ); - exit; - } - - /** - * Uploads a document. - * - * @param array $files the $_FILES variable - * @param string $path - * @param string $title - * @param string $comment - * @param int $unzip unzip or not the file - * @param string $ifExists overwrite, rename or warn (default) - * @param bool $index_document index document (search xapian module) - * @param bool $show_output print html messages - * @param string $fileKey - * @param bool $treat_spaces_as_hyphens - * @param int $parentId - * @param string $content - * - * @return CDocument|false - */ - public static function upload_document( - $files, - $path, - $title = '', - $comment = '', - $unzip = 0, - $ifExists = '', - $index_document = false, - $show_output = false, - $fileKey = 'file', - $treat_spaces_as_hyphens = true, - $parentId = 0, - $content = null - ) { - $course_info = api_get_course_info(); - $sessionId = api_get_session_id(); - - if (isset($files[$fileKey])) { - $uploadOk = process_uploaded_file($files[$fileKey], $show_output); - - if ($uploadOk) { - $document = handle_uploaded_document( - $course_info, - $files[$fileKey], - null, - $path, - api_get_user_id(), - api_get_group_id(), - null, - $unzip, - $ifExists, - $show_output, - false, - null, - $sessionId, - $treat_spaces_as_hyphens, - $fileKey, - $parentId, - $content - ); - - // Showing message when sending zip files - if ($document && 1 == $unzip) { - if ($show_output) { - echo Display::return_message( - get_lang('File upload succeeded!').'
', - 'confirm', - false - ); - } - - return $document; - } - - if ($document) { - if ($index_document) { - self::index_document( - $document->getIid(), - $course_info['code'], - null, - $_POST['language'] ?? '', - $_REQUEST, - $ifExists - ); - } - - return $document; - } - } - } - - return false; - } - /** * Obtains the text inside the file with the right parser. */ diff --git a/public/main/lp/learnpathItem.class.php b/public/main/lp/learnpathItem.class.php index ba511b1308..bd14d96a5a 100644 --- a/public/main/lp/learnpathItem.class.php +++ b/public/main/lp/learnpathItem.class.php @@ -4043,7 +4043,8 @@ class learnpathItem return false; } - $document = DocumentManager::upload_document( + $document = null; + /*$document = DocumentManager::upload_document( $_FILES, null, null, @@ -4055,7 +4056,7 @@ class learnpathItem 'file', false, $folderDocument->getIid(), - ); + );*/ if ($document) { $name = '/audio/'.$document->getResourceNode()->getResourceFile()->getOriginalName(); diff --git a/public/main/lp/lp_admin_view.php b/public/main/lp/lp_admin_view.php index 0b53c99910..99238fe720 100644 --- a/public/main/lp/lp_admin_view.php +++ b/public/main/lp/lp_admin_view.php @@ -118,9 +118,9 @@ if (isset($_POST['save_audio'])) { // Using the new name in the $_FILES superglobal. $_FILES[$key]['name'] = $clean_name; } - + $filePath = null; // Upload the file in the documents tool. - $filePath = handle_uploaded_document( + /*$filePath = handle_uploaded_document( $_course, $_FILES[$key], api_get_path(SYS_COURSE_PATH).$_course['path'].'/document', @@ -131,7 +131,7 @@ if (isset($_POST['save_audio'])) { '', '', false - ); + );*/ // Store the mp3 file in the lp_item table. $sql = "UPDATE $tbl_lp_item diff --git a/public/plugin/courselegal/CourseLegalPlugin.php b/public/plugin/courselegal/CourseLegalPlugin.php index 3cd9f03899..188aeb35ac 100644 --- a/public/plugin/courselegal/CourseLegalPlugin.php +++ b/public/plugin/courselegal/CourseLegalPlugin.php @@ -362,7 +362,8 @@ class CourseLegalPlugin extends Plugin $fileName = null; if ($uploadOk) { - $uploadResult = handle_uploaded_document( + $uploadResult = null; + /*$uploadResult = handle_uploaded_document( $course, $file, $coursePath, @@ -374,7 +375,7 @@ class CourseLegalPlugin extends Plugin false, false, true - ); + );*/ if ($uploadResult) { $fileName = basename($uploadResult); diff --git a/public/plugin/zoom/lib/ZoomPlugin.php b/public/plugin/zoom/lib/ZoomPlugin.php index 30ab875de3..cf28f65447 100644 --- a/public/plugin/zoom/lib/ZoomPlugin.php +++ b/public/plugin/zoom/lib/ZoomPlugin.php @@ -651,7 +651,8 @@ class ZoomPlugin extends Plugin $groupId = $group->getIid(); } - $newPath = handle_uploaded_document( + $newPath = null; + /*$newPath = handle_uploaded_document( $courseInfo, [ 'name' => $name, @@ -673,7 +674,7 @@ class ZoomPlugin extends Plugin null, $sessionId, true - ); + );*/ fclose($tmpFile); if (false === $newPath) {