Example #1
0
function view_file($user)
{
    $name = get_str('name');
    $dir = sandbox_dir($user);
    list($error, $size, $md5) = sandbox_parse_link_file("{$dir}/{$name}");
    if ($error) {
        error_page("no such link file");
    }
    $p = sandbox_physical_path($user, $md5);
    if (!is_file($p)) {
        error_page("no such physical file");
    }
    echo "<pre>\n";
    readfile($p);
    echo "</pre>\n";
}
Example #2
0
function get_file_path($user, $name)
{
    $fname = get_str($name);
    // verify that the files exist in sandbox
    //
    $sbdir = sandbox_dir($user);
    list($error, $size, $md5) = sandbox_parse_link_file("{$sbdir}/{$fname}");
    if ($error) {
        error_page("no {$name} file");
    }
    return sandbox_physical_path($user, $md5);
}