예제 #1
0
    } else {
        $course_id = $_SESSION['course_id'];
    }
    // anonymous with access token needs course id set
}
require_once 'doc_init.php';
require_once 'include/lib/forcedownload.php';
if (defined('GROUP_DOCUMENTS')) {
    if (!$uid) {
        error($langNoRead);
    }
    if (!($is_editor or $is_member)) {
        error($langNoRead);
    }
}
$file_info = public_path_to_disk_path($path_components);
if (!$is_editor and !resource_access($file_info->visible, $file_info->public)) {
    error($langNoRead);
}
if ($file_info->extra_path) {
    // $disk_path is set if common file link
    $disk_path = common_doc_path($file_info->extra_path, true);
    if (!$disk_path) {
        // external file URL
        header("Location: {$file_info->extra_path}");
        exit;
    } elseif (!$common_doc_visible) {
        forbidden(preg_replace('/^.*file\\.php/', '', $uri));
    }
} else {
    // Normal file
예제 #2
0
파일: show.php 프로젝트: nikosv/openeclass
/**
 * 
 * @global type $basedir 
 * @param type $file_path
 * @param type $initial_path
 */
function send_file_by_url_file_path($file_path, $initial_path = '') {
    global $basedir;

    $path_components = explode('/', str_replace('//', chr(1), $file_path));
    $file_info = public_path_to_disk_path($path_components, $initial_path);

    if (!send_file_to_client($basedir . $file_info->path, $file_info->filename, null, false)) {
        not_found($file_path);
    }
    exit;
}
예제 #3
0
/**
 * 
 * @global type $basedir
 * @global type $uid
 * @param type $file_path
 * @param type $initial_path
 */
function send_file_by_url_file_path($file_path, $initial_path = '')
{
    global $basedir, $uid;
    $path_components = explode('/', str_replace('//', chr(1), $file_path));
    $file_info = public_path_to_disk_path($path_components, $initial_path);
    $valid = $uid ? true : token_validate($file_info->path, $_GET['token'], 30);
    if (!$valid) {
        header("Location: {$urlServer}");
        exit;
    }
    if (!send_file_to_client($basedir . $file_info->path, $file_info->filename, null, false)) {
        not_found($file_path);
    }
    exit;
}