private function getfile() { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'assets' . DS . 'export_helper.php'; $tid = JRequest::getVar('tid'); $ehelper = new OnepageTemplateHelper(); $hash2 = $ehelper->getFileHash($tid); $tt = $ehelper->getTemplate($tid); $hash = JRequest::getVar('hash'); $filepath = JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_onepage' . DS . 'export' . DS . 'templates' . DS; if (strtolower($hash) == $hash2 && is_numeric($tid)) { $filename = $tt['file']; $file = $filepath . $tt['file']; if (!file_exists($file)) { die('File does not exists! ' . $file); } $d = @ob_get_clean(); $d = @ob_get_clean(); $d = @ob_get_clean(); $d = @ob_get_clean(); $d = @ob_get_clean(); unset($d); $fsize = filesize($file); if (@ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } $ctype = $ehelper->getFileHeader($file); header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); // required for certain browsers header("Content-Type: {$ctype}"); header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $fsize); @ob_clean(); @flush(); readfile($file); //echo 'filename'; $app = JFactory::getApplication()->close(); die; } unset($hash2); unset($res); }