| Server IP : 54.36.91.62 / Your IP : 216.73.217.111 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/components/com_djcatalog2/controllers/ |
Upload File : |
<?php
/**
* @package DJ-Catalog2
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined('_JEXEC') or die( 'Restricted access' );
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\MVC\Controller\AdminController;
jimport('joomla.application.component.controlleradmin');
class Djcatalog2ControllerQuestions extends AdminController
{
public function downloadExport() {
$app = Factory::getApplication();
$jinput = $app->input;
$user = Factory::getUser();
if ($user->guest) {
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
$file = $jinput->get('file', null, 'base64');
if(!strlen($file)) {
throw new Exception(Text::_('COM_DJCATALOG2_FILE_NOT_FOUND'), 403);
}
$app = Factory::getApplication();
$user = Factory::getUser();
$file_path = Djcatalog2ExportHelper::getExportPath('quotes') . '/' . base64_decode(($file));
if (strpos($file_path, 'U' . $user->id .'.csv') === false) {
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
if (empty($file) || !File::exists($file_path) || strpos($file_path, 'media') === false || strpos($file_path, 'djcatalog2') === false) {
$this->setRedirect( 'index.php?option=com_djcatalog2', Text::sprintf('COM_DJCATALOG2_ERROR_FILE_MISSING', base64_decode($file)), 'error' );
return false;
}
if (!DJCatalog2FileHelper::getFileByPath($file_path, null, 'text/csv')){
//JError::raiseError(404);
throw new Exception('', 404);
return false;
}
$app->close();
return true;
}
public function export() {
$this->checkToken();
$user = Factory::getUser();
if ($user->guest) {
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
$params = DJCatalog2Helper::getParams();
if(!$params->get('export_quotes_frontend')) {
throw new Exception(Text::_('COM_DJCATALOG2_FRONTEND_QUOTES_EXPORT_DISABLED'), 403);
}
$app = Factory::getApplication();
$jinput = $app->input;
$cid = $jinput->get('cid', array(), 'array');
$file = Djcatalog2ExportHelper::exportQuotes($cid);
if($file['success']) {
$file_link = '<a href="' . Route::_('index.php?option=com_djcatalog2&task=questions.downloadExport&file=' . base64_encode($file['filename'])) . '">' . $file['filename'] . '</a></br>';
$this->setRedirect(Route::_('index.php?option=com_djcatalog2&view=questions'), Text::_('COM_DJCATALOG2_EXPORT_SUCCESFULL') . ' ' . $file_link);
}
}
}