'; $errorTEXTkonec = '


'; if (isset($_GET["id"]) && intval($_GET["id"])): $urceni = "soubor"; $strDotaz->constructObjectBase(); $strDotaz->constructObjectSQL($urceni); $strDotaz->constructObjectLogEdit($urceni); $strDotaz->constructObjectNazev(); if (isset($_GET["v"]) && intval($_GET["v"])): $strDotaz->addPodminky("obj_sys_typ_soubory_verze.verze=".$_GET["v"]); else: $strDotaz->addPodminky("obj_sys_typ_soubory_verze.aktualni_verze=1"); endif; $strDotaz->addPodminky("obj.id=".$_GET['id']); if ($vysledekOBJEKT = myQUERY($strDotaz->select(),__FILE__,__LINE__)): if (myQUERYnumROWS($vysledekOBJEKT)): $radekOBJEKT = myQUERYfetchARRAY($vysledekOBJEKT); $radekOBJEKT = loadObjektSkupiny($radekOBJEKT,__FILE__,__LINE__); $objOBJEKT = createObjekt($radekOBJEKT,$urceni,__FILE__,__LINE__); if (myISaccess("r",$objOBJEKT)) : $nazev = $radekOBJEKT["nazev"]; $pripona = $radekOBJEKT["pripona"]; // $filename = urlencode(strtr($objOBJEKT->nazev," ?*/мљишћэбнйъщутсќпѕ","_-X-escrzyaieuuonntdl")."_v".$objOBJEKT->verze.".".$objOBJEKT->pripona); $filename = urlencode($objOBJEKT->nazev." (v".$objOBJEKT->verze.").".$objOBJEKT->pripona); $filepath = $GLOBALS["PATHS"]["PATH_ROOT"].'files/file.'.$objOBJEKT->id.".".$objOBJEKT->verze.".".$objOBJEKT->pripona; if (file_exists($filepath)): $filesize = FileSize($filepath); header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Type: application/'.(($objOBJEKT->pripona == "pdf")?'pdf':'octet-stream')); // header('Content-Type: '.mime_content_type($filepath)); header("Content-Length: ".$filesize); header("Content-Disposition: inline; filename=$filename"); header("Content-Transfer-Encoding: binary"); //Can't use readfile() due to poor controlling of the file download. //(IE have this problems)... //readfile($filepath); //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $myfile_buffer = fread($fp, $filesize); fclose ($fp); //sleep(1); print $myfile_buffer; //Required, to keep IE from running into problems //when opening the file while downloading or downloading... //(IE been acting strange lately...)*/ else: echo $errorTEXTzacatek.defaults("downloadSOUBORchybi")."
".$filepath.$errorTEXTkonec; exit; endif; else: echo $errorTEXTzacatek.defaults("downloadSOUBORprava").$errorTEXTkonec; exit; endif; else: echo $errorTEXTzacatek.defaults("downloadSOUBORnenalezen").$errorTEXTkonec; echo $strDotaz->select(); endif; else: echo $errorTEXTzacatek.defaults("downloadERRORsql").$errorTEXTkonec; exit; endif; else: echo $errorTEXTzacatek.defaults("downloadNEPLATNYformat").$errorTEXTkonec; exit; endif; if (isset($GLOBALS["m_errors"]) && count($GLOBALS["m_errors"])): echo ''."\n"; echo $GLOBALS["htmlbreak"]; endif; // $strDotazInsert = "INSERT INTO sys_objekty_download (sys_objekty_id,datum_stazeni) VALUES (".$_GET["fileID"].",'".strftime("%Y-%m-%d %H:%M:%S")."')"; // myQUERY($strDotazInsert,__FILE__,__LINE__); ?>