smtp and viewr password moved to generated config.php
This commit is contained in:
@ -89,16 +89,18 @@ class Renderer
|
|||||||
// Copy handler
|
// Copy handler
|
||||||
copy($this->templatesPath . '/emailer.php', $projectExportDir . '/ajax.php');
|
copy($this->templatesPath . '/emailer.php', $projectExportDir . '/ajax.php');
|
||||||
|
|
||||||
// Create config for handler
|
// Create config for handler (PHP file is not web-accessible)
|
||||||
$siteConfig = [
|
$siteConfig = [
|
||||||
'site_name' => $projectData['wizard_data']['identity']['business_name'],
|
'site_name' => $projectData['wizard_data']['identity']['business_name'],
|
||||||
'form_mode' => $formConfig['mode'] ?? 'local',
|
'form_mode' => $formConfig['mode'] ?? 'local',
|
||||||
'smtp' => $formConfig['smtp'] ?? null,
|
'smtp' => $formConfig['smtp'] ?? null,
|
||||||
'local_password_hash' => $formConfig['local_viewer']['password_hash'] ?? null
|
'local_password_hash' => $formConfig['local_viewer']['password_hash'] ?? null
|
||||||
];
|
];
|
||||||
file_put_contents($projectExportDir . '/config.json', json_encode($siteConfig, JSON_PRETTY_PRINT));
|
|
||||||
|
|
||||||
if ($siteConfig['form_mode'] === 'local') {
|
$configContent = "<?php\nreturn " . var_export($siteConfig, true) . ";\n";
|
||||||
|
file_put_contents($projectExportDir . '/config.php', $configContent);
|
||||||
|
|
||||||
|
if (($siteConfig['form_mode'] ?? 'local') === 'local') {
|
||||||
// Copy viewer
|
// Copy viewer
|
||||||
copy($this->templatesPath . '/form-viewer.php', $projectExportDir . '/form-viewer.php');
|
copy($this->templatesPath . '/form-viewer.php', $projectExportDir . '/form-viewer.php');
|
||||||
// Create messages dir
|
// Create messages dir
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
$config = [];
|
$config = [];
|
||||||
if (file_exists('config.json')) {
|
if (file_exists('config.php')) {
|
||||||
$config = json_decode(file_get_contents('config.json'), true);
|
$config = include 'config.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendResponse(bool $success, string $message) {
|
function sendResponse(bool $success, string $message) {
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$config = [];
|
$config = [];
|
||||||
if (file_exists('config.json')) {
|
if (file_exists('config.php')) {
|
||||||
$config = json_decode(file_get_contents('config.json'), true);
|
$config = include 'config.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$passwordHash = $config['local_password_hash'] ?? null;
|
$passwordHash = $config['local_password_hash'] ?? null;
|
||||||
|
|||||||
Reference in New Issue
Block a user