getItem("constantes"); $url = $constantes['srcDocs']; $nombreFichero=""; $nombreMostrar=""; $estado=false; switch ($_GET['tipo']) { case "cv": if(!$usuario->tieneRol("4") && !$usuario->tieneRol("3")){ $msg=$locale['1491']; } else { $estado=true; try{ $nombreFichero=$usuario->getRutaCV($_GET['cod']); $nombreMostrar=$usuario->getNombreCV($_GET['cod']); } catch(Exception $e){ $estado=false; } } break; case "doc": include_once("Objects/Documento.php"); $documento=new Documento($_GET['cod']); $roles=$documento->getValor("rol"); if($usuario->tieneRolLista($roles)){ // Puede descargarselo $nombreFichero=SLASH."documentos".SLASH.$documento->getValor("ruta"); $extension=strrchr($documento->getValor("ruta"),"."); $nombreMostrar=$documento->getValor("nombre").$extension; $estado=true; }else{ $estado=false; $msg=$locale['1491']; } break; case "back": if(!$usuario->tieneRol("2")){ $msg=$locale['1491']; } else { $estado=true; $nombreFichero=SLASH."bdcopy".SLASH.$_GET['cod']; $nombreMostrar=$_GET['cod']; } break; default: break; } if($estado){ $ruta=$url.SLASH.$nombreFichero; header( "Content-Disposition: attachment; filename=\"".$nombreMostrar."\""); header( "Content-type: application/octet-stream" ); header( "Content-Description: File Transfer"); header( "Content-Type: application/octet-stream"); header( "Content-Transfer-Encoding: binary"); header( "Expires: 0"); header( "Cache-Control: must-revalidate, post-check=0, pre-check=0"); header( "Pragma: public"); header( "Content-Length: ".filesize($ruta)); @readfile( $ruta ); //echo $ruta; } else { if($msg=="") $msg=$locale['1490']; include_once("showError.php"); } ?>