diff --git a/main/document/recycle.php b/main/document/recycle.php index fc2c93614f..49da00fe67 100644 --- a/main/document/recycle.php +++ b/main/document/recycle.php @@ -26,7 +26,7 @@ $actions .= Display::url( ); $action = isset($_GET['action']) ? $_GET['action'] : ''; -$id = isset($_GET['id']) ? intval($_GET['id']) : ''; +$id = isset($_GET['id']) ? (int) $_GET['id'] : ''; $currentUrl = api_get_self().'?'.api_get_cidreq(); switch ($action) { @@ -51,8 +51,8 @@ switch ($action) { } $interbreadcrumb[] = [ - "url" => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(), - "name" => get_lang('Documents'), + 'url' => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(), + 'name' => get_lang('Documents'), ]; $template = new Template(get_lang('DeletedDocuments')); $template->assign('files', $files); diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index d261012426..271fe95856 100644 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -1069,7 +1069,7 @@ class DocumentManager // Deleting from the DB $user_id = api_get_user_id(); - $document_id = intval($document_id); + $document_id = (int) $document_id; if (empty($course_info)) { $course_info = api_get_course_info(); @@ -1135,12 +1135,13 @@ class DocumentManager ) { $TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); - $groupId = intval($groupId); + $documentId = (int) $documentId; + $groupId = (int) $groupId; if (empty($groupId)) { $groupId = api_get_group_id(); } - $sessionId = intval($sessionId); + $sessionId = (int) $sessionId; if (empty($sessionId)) { $sessionId = api_get_session_id(); } @@ -1177,8 +1178,6 @@ class DocumentManager $path = $docInfo['path']; } - $documentId = intval($documentId); - if (empty($path) || empty($docInfo) || empty($documentId)) { return false; } @@ -5721,9 +5720,9 @@ class DocumentManager return true; } elseif ($clean_curdirpath == '/shared_folder_session_'.$sessionId) { return true; - } else { - return false; } + + return false; } /** @@ -5741,9 +5740,9 @@ class DocumentManager return true; } elseif (strpos($clean_path, 'shared_folder_session_'.$sessionId.'/sf_user_')) { return true; - } else { - return false; } + + return false; } /** @@ -5872,9 +5871,9 @@ class DocumentManager { if (api_strripos($document_name, $keyword) !== false) { return true; - } else { - return false; } + + return false; } /** @@ -5991,6 +5990,7 @@ class DocumentManager $table = Database::get_course_table(TABLE_DOCUMENT); $courseId = $courseInfo['real_id']; + $id = (int) $id; $sessionCondition = api_get_session_condition($sessionId); $sql = "SELECT * FROM $table WHERE @@ -6057,7 +6057,7 @@ class DocumentManager $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/'; if (Security::check_abs_path($coursePath.$document['path'], $coursePath)) { - self::file_send_for_download($coursePath.$document['path']); + self::file_send_for_download($coursePath.$document['path'], true); exit; } } @@ -6080,7 +6080,7 @@ class DocumentManager $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; // Creating a ZIP file. - $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; + $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().'.zip'; $zip = new PclZip($tempZipFile); foreach ($files as $file) { $zip->add(