public function download_file() { $app = JFactory::getApplication(); $user = JFactory::getUser(); if (!$user->authorise('core.manage', 'com_djcatalog2') && !$user->authorise('core.admin', 'com_djcatalog2')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $path = $app->input->get('path', null, 'base64'); $file_path = JPATH_ROOT . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, base64_decode($path)); if (empty($path) || !JFile::exists($file_path)) { $this->setRedirect('index.php?option=com_djcatalog2', JText::sprintf('COM_DJCATALOG2_ERROR_FILE_MISSING', base64_decode($path)), 'error'); return false; } if (!DJCatalog2FileHelper::getFileByPath($file_path)) { //JError::raiseError(404); throw new Exception('', 404); return false; } return true; }