$group_id = $request->get('group_id');
    $file_id = $request->get('file_id');
} else {
    exit_missing_param();
}
$frsff = new FRSFileFactory();
$frspf = new FRSPackageFactory();
// Must have a group_id and file_id otherwise
// we cannot do much
if (!$file_id || !$group_id) {
    exit_missing_param();
}
if (!$GLOBALS['sys_frs_license_mandatory']) {
    // Display license popup?
    // This is useful when using a 'file #123' reference, that points to this script
    $res =& $frspf->getFRSPackageByFileIdFromDb($file_id);
    //$sql="SELECT approve_license FROM frs_package,frs_release,frs_file WHERE frs_file.file_id=$file_id and frs_file.release_id=frs_release.release_id and  frs_release.package_id=frs_package.package_id";
    //res = db_query( $sql);
    if (count($res) > 0) {
        if ($res->getApproveLicense() == 0) {
            // Directly display file
            $location = "Location: /file/download.php/{$group_id}/{$file_id}";
            header($location);
        }
    }
}
if ($request->exist('popup')) {
    $dlscript = 'opener.download';
    $cancelscript = 'window.close()';
} else {
    $dlscript = 'download_local';