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