Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/social/download_my_files.php

30 lines
673 B

<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
$userId = isset($_GET['user_id']) ? (int) $_GET['user_id'] : 0;
$file = isset($_GET['file']) ? $_GET['file'] : '';
if (empty($userId) || empty($file)) {
exit;
}
$dir = UserManager::getUserPathById($userId, 'system');
if (empty($dir)) {
exit;
}
$file = $dir.'/my_files/'.$file;
$config = api_get_configuration_value('block_my_files_access');
if ($config) {
api_block_anonymous_users();
}
if (Security::check_abs_path($file, $dir.'my_files/')) {
$result = DocumentManager::file_send_for_download($file);
if ($result === false) {
exit;
}
}