Remove/Comment unused code

pull/3924/head
Julio Montoya 4 years ago
parent bbdf875b11
commit ce8c11cdb3
  1. 6
      public/main/course_info/download.php
  2. 4
      public/main/inc/ajax/lp.ajax.php
  3. 4
      public/main/inc/ajax/record_audio_rtc.ajax.php
  4. 8
      public/main/inc/lib/MoodleImport.php
  5. 153
      public/main/inc/lib/document.lib.php
  6. 5
      public/main/lp/learnpathItem.class.php
  7. 6
      public/main/lp/lp_admin_view.php
  8. 5
      public/plugin/courselegal/CourseLegalPlugin.php
  9. 5
      public/plugin/zoom/lib/ZoomPlugin.php

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
exit;
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
/**
@ -17,7 +20,8 @@ if (isset($_GET['archive_path'])) {
$archive_file = isset($_GET['archive']) ? $_GET['archive'] : null;
$archive_file = str_replace(['..', '/', '\\'], '', $archive_file);
list($extension) = getextension($archive_file);
$extension = null;
//list($extension) = getextension($archive_file);
if (empty($extension) || !file_exists($archive_path.$archive_file)) {
exit;

@ -176,7 +176,7 @@ switch ($action) {
$file['name'] = $title.'.'.$fileInfo['extension'];
$file['file'] = $file;
$result = DocumentManager::upload_document(
/*$result = DocumentManager::upload_document(
$file,
'/audio',
$file['name'],
@ -185,7 +185,7 @@ switch ($action) {
'overwrite',
false,
false
);
);*/
if (!empty($result) && is_array($result)) {
$newDocId = $result['id'];

@ -54,7 +54,7 @@ switch ($type) {
$audioDir = '/';
}
$uploadedDocument = DocumentManager::upload_document(
/*$uploadedDocument = DocumentManager::upload_document(
$file,
$audioDir,
$file['name'],
@ -70,7 +70,7 @@ switch ($type) {
api_get_session_id(),
api_get_group_id(),
'exercise' === $tool
);
);*/
$error = empty($uploadedDocument) || !is_array($uploadedDocument);

@ -138,7 +138,7 @@ class MoodleImport
$title = isset($fileInfo['title']) ? $fileInfo['title'] : pathinfo($fileInfo['filename'], PATHINFO_FILENAME);
$data = DocumentManager::upload_document(
/*$data = DocumentManager::upload_document(
$files,
'/moodle',
$title,
@ -149,7 +149,7 @@ class MoodleImport
true,
'file',
false
);
);*/
if ($data) {
$importedFiles[$fileInfo['filename']] = basename($data['path']);
@ -344,7 +344,7 @@ class MoodleImport
$_POST['language'] = $courseInfo['language'];
$_POST['moodle_import'] = true;
DocumentManager::upload_document(
/*DocumentManager::upload_document(
$files,
'/moodle',
$fileInfo['title'],
@ -353,7 +353,7 @@ class MoodleImport
null,
true,
true
);
);*/
}
break;

@ -2207,159 +2207,6 @@ class DocumentManager
return $content_html;
}
/**
* Export document to PDF.
*
* @param int $documentId
* @param string $courseCode
* @param string $orientation
* @param bool $showHeaderAndFooter
*/
public static function export_to_pdf(
$documentId,
$courseCode,
$orientation = 'landscape',
$showHeaderAndFooter = true
) {
$repo = Container::getDocumentRepository();
$document = $repo->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!').'<br />',
'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.
*/

@ -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();

@ -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

@ -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);

@ -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) {

Loading…
Cancel
Save