Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/public_html/administrator/components/com_convertforms/controllers/ |
<?php
/**
* @package Convert Forms
* @version 4.3.3 Pro
*
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2023 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/**
* Export controller class.
*/
class ConvertFormsControllerExport extends JControllerAdmin
{
/**
* Used by the export form to submit the data
*
* @return void
*/
public function export()
{
JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$input = $app->input;
$tz = new \DateTimeZone($app->getCfg('offset', 'GMT'));
$date = \JFactory::getDate()->setTimezone($tz)->format('YmdHis', true);
$filename = 'convertforms_submissions_' . $date . '.' . $input->get('export_type');
$options = $input->getArray();
$options['filter_search'] = $input->get('filter_search', null, 'RAW'); // Allow commas and special characters.
$options['filename'] = $input->get('filename', $filename);
$app->redirect('index.php?option=com_convertforms&view=export&layout=progress&' . http_build_query($options));
}
/**
* Force download of the exported file
*
* @return void
*/
public function download()
{
if (!$filename = JFactory::getApplication()->input->get('filename', '', 'RAW'))
{
throw new Exception('Invalid filename');
}
$filename = NRFramework\File::getTempFolder() . $filename;
if (!JFile::exists($filename))
{
throw new Exception('Invalid filename');
}
error_reporting(0);
// Send the appropriate headers to force the download in the browser
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Expires: 0');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public", false);
header('Pragma: public');
header('Content-Length: ' . @filesize($filename));
// Read exported file to buffer
readfile($filename);
// Don't leave any clues on the server. Delete the file.
JFile::delete($filename);
jexit();
}
}