| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/brainwavemx/app/Controller/admin/ |
Upload File : |
<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Model\ConfigModel;
use Mosaico\Controller\BaseController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ConfigController extends BaseController
{
protected $configModel;
public function __construct()
{
$this->auth();
$this->configModel = new ConfigModel();
}
public function configMailer(): string
{
/*
* mail contact id_type = 1
*/
$config = $this->configModel->getConfigByType(1);
return $this->template(
'admin/configMailer',
[
'config' => is_object($config) ? $config->rows : '',
'title' => 'Mail Configuration',
'env' => $this->getEnv()
]
);
}
public function updateConfig(Request $request): string
{
$id = $request->request->get('id');
$value = $request->request->get('value');
$response = [];
$this->configModel->updateValueById($id, $value);
if ($request->request->get('value')) :
$response['message'] = '<div class="alert alert-success text-center">' .
'La configuración de ' . $id . ' ha sido actualizada' .
'</div>';
else :
$response['message'] = '<div class="alert alert-danger text-center">' .
'Hubo un problema al actualizar la configuración de ' . $id .
'</div>';
endif;
return json_encode($response);
}
}