Initial commit
This commit is contained in:
36
install/core/actions/buildDatabase.php
Normal file
36
install/core/actions/buildDatabase.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = array('success' => true, 'errorMsg' => '');
|
||||
|
||||
$installer->rebuild();
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
76
install/core/actions/checkPermission.php
Normal file
76
install/core/actions/checkPermission.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
|
||||
$result = ['success' => true, 'errorMsg' => ''];
|
||||
|
||||
if (!$installer->checkPermission()) {
|
||||
$result['success'] = false;
|
||||
$error = $installer->getLastPermissionError();
|
||||
|
||||
$urls = array_keys($error);
|
||||
|
||||
$group = [];
|
||||
|
||||
foreach ($error as $folder => $permission) {
|
||||
$group[implode('-', $permission)][] = $folder;
|
||||
}
|
||||
|
||||
ksort($group);
|
||||
|
||||
$instruction = '';
|
||||
$instructionSU = '';
|
||||
$changeOwner = true;
|
||||
|
||||
foreach($group as $permission => $folders) {
|
||||
if ($permission == '0644-0755') {
|
||||
$folders = '';
|
||||
}
|
||||
|
||||
$instruction .= $systemHelper
|
||||
->getPermissionCommands([$folders, ''], explode('-', $permission), false, null, $changeOwner) . "<br>";
|
||||
|
||||
$instructionSU .= $systemHelper
|
||||
->getPermissionCommands([$folders, ''], explode('-', $permission), true, null, $changeOwner) . "<br>";
|
||||
|
||||
if ($changeOwner) {
|
||||
$changeOwner = false;
|
||||
}
|
||||
}
|
||||
|
||||
$result['errorMsg'] = $langs['messages']['Permission denied to'] . ':<br><pre>'.implode('<br>', $urls).'</pre>';
|
||||
|
||||
$result['errorFixInstruction'] =
|
||||
str_replace( '"{C}"' , $instruction, $langs['messages']['permissionInstruction']) .
|
||||
"<br>" . str_replace( '{CSU}' , $instructionSU, $langs['messages']['operationNotPermitted']);
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
49
install/core/actions/createUser.php
Normal file
49
install/core/actions/createUser.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = ['success' => false, 'errorMsg' => ''];
|
||||
|
||||
// create user
|
||||
if (!empty($_SESSION['install']['user-name']) && !empty($_SESSION['install']['user-pass'])) {
|
||||
$userId = $installer->createUser($_SESSION['install']['user-name'], $_SESSION['install']['user-pass']);
|
||||
|
||||
if (!empty($userId)) {
|
||||
$result['success'] = true;
|
||||
} else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot create user';
|
||||
}
|
||||
} else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot create user';
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
30
install/core/actions/errors.php
Normal file
30
install/core/actions/errors.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
|
||||
38
install/core/actions/finish.php
Normal file
38
install/core/actions/finish.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$cronMessage = $installer->getCronMessage();
|
||||
|
||||
$smarty->assign('cronTitle', $cronMessage['message']);
|
||||
$smarty->assign('cronHelp', $cronMessage['command']);
|
||||
|
||||
$installer->setSuccess();
|
||||
|
||||
// clean session
|
||||
session_unset();
|
||||
58
install/core/actions/main.php
Normal file
58
install/core/actions/main.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$config = $installer->getConfig();
|
||||
|
||||
$fields = [
|
||||
'user-lang' => [
|
||||
'default' => $config->get('language', 'en_US'),
|
||||
],
|
||||
'theme' => [
|
||||
'default' => $config->get('theme'),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = (isset($field['default']))? $field['default'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$language = $installer->createLanguage($_SESSION['install']['user-lang'] ?? 'en_US');
|
||||
|
||||
$themes = [];
|
||||
foreach ($installer->getThemeList() as $item) {
|
||||
$themes[$item] = $language->translate($item, 'themes', 'Global');
|
||||
}
|
||||
|
||||
$smarty->assign('themeLabel', $language->translate('theme', 'fields', 'Settings'));
|
||||
$smarty->assign('fields', $fields);
|
||||
$smarty->assign("themes", $themes);
|
||||
74
install/core/actions/saveEmailSettings.php
Normal file
74
install/core/actions/saveEmailSettings.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = ['success' => false, 'errorMsg' => ''];
|
||||
|
||||
if (!empty($_SESSION['install'])) {
|
||||
|
||||
$paramList = [
|
||||
'outboundEmailFromName',
|
||||
'outboundEmailFromAddress',
|
||||
'outboundEmailIsShared',
|
||||
];
|
||||
|
||||
$preferences = [];
|
||||
|
||||
foreach ($paramList as $paramName) {
|
||||
switch ($paramName) {
|
||||
case 'outboundEmailIsShared':
|
||||
$preferences['outboundEmailIsShared'] = $_SESSION['install']['outboundEmailIsShared'] === 'true';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (array_key_exists($paramName, $_SESSION['install'])) {
|
||||
$preferences[$paramName] = $_SESSION['install'][$paramName];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$res = $installer->savePreferences($preferences);
|
||||
|
||||
if (!empty($res)) {
|
||||
$result['success'] = true;
|
||||
} else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot save preferences';
|
||||
}
|
||||
} else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot save preferences';
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
66
install/core/actions/savePreferences.php
Normal file
66
install/core/actions/savePreferences.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = array('success' => false, 'errorMsg' => '');
|
||||
|
||||
if (!empty($_SESSION['install'])) {
|
||||
$paramList = [
|
||||
'dateFormat',
|
||||
'timeFormat',
|
||||
'timeZone',
|
||||
'weekStart',
|
||||
'defaultCurrency',
|
||||
'thousandSeparator',
|
||||
'decimalMark',
|
||||
'language',
|
||||
];
|
||||
|
||||
$preferences = [];
|
||||
foreach ($paramList as $paramName) {
|
||||
if (array_key_exists($paramName, $_SESSION['install'])) {
|
||||
$preferences[$paramName] = $_SESSION['install'][$paramName];
|
||||
}
|
||||
}
|
||||
|
||||
$res = $installer->savePreferences($preferences);
|
||||
if (!empty($res)) {
|
||||
$result['success'] = true;
|
||||
} else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot save preferences';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = 'Cannot save preferences';
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
76
install/core/actions/saveSettings.php
Normal file
76
install/core/actions/saveSettings.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
|
||||
$result = [
|
||||
'success' => true,
|
||||
'errorMsg' => '',
|
||||
];
|
||||
|
||||
// save settings
|
||||
$database = [
|
||||
'dbname' => $_SESSION['install']['db-name'],
|
||||
'user' => $_SESSION['install']['db-user-name'],
|
||||
'password' => $_SESSION['install']['db-user-password'],
|
||||
'platform' => $_SESSION['install']['db-platform'] ?? 'Mysql',
|
||||
];
|
||||
|
||||
$host = $_SESSION['install']['host-name'];
|
||||
|
||||
if (!str_contains($host, ':')) {
|
||||
$host .= ":";
|
||||
}
|
||||
|
||||
[$database['host'], $database['port']] = explode(':', $host);
|
||||
|
||||
$saveData = [
|
||||
'database' => $database,
|
||||
'language' => !empty($_SESSION['install']['user-lang']) ? $_SESSION['install']['user-lang'] : 'en_US',
|
||||
'siteUrl' => !empty($_SESSION['install']['site-url']) ? $_SESSION['install']['site-url'] : null,
|
||||
];
|
||||
|
||||
if (!empty($_SESSION['install']['theme'])) {
|
||||
$saveData['theme'] = $_SESSION['install']['theme'];
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['install']['default-permissions-user']) && !empty($_SESSION['install']['default-permissions-group'])) {
|
||||
$saveData['defaultPermissions'] = [
|
||||
'user' => $_SESSION['install']['default-permissions-user'],
|
||||
'group' => $_SESSION['install']['default-permissions-group'],
|
||||
];
|
||||
}
|
||||
|
||||
if (!$installer->saveData($saveData)) {
|
||||
$result['success'] = false;
|
||||
$result['errorMsg'] = $langs['messages']['Can not save settings'];
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
131
install/core/actions/settingsTest.php
Normal file
131
install/core/actions/settingsTest.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
|
||||
$result = [
|
||||
'success' => true,
|
||||
'errors' => [],
|
||||
];
|
||||
|
||||
$phpRequiredList = $installer->getSystemRequirementList('php', true);
|
||||
|
||||
foreach ($phpRequiredList as $name => $details) {
|
||||
if (!$details['acceptable']) {
|
||||
|
||||
switch ($details['type']) {
|
||||
case 'version':
|
||||
$result['success'] = false;
|
||||
$result['errors']['phpVersion'] = $details['required'];
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$result['success'] = false;
|
||||
$result['errors']['phpRequires'][] = $name;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$allPostData = $postData->getAll();
|
||||
|
||||
if (
|
||||
$result['success'] &&
|
||||
!empty($allPostData['dbName']) &&
|
||||
!empty($allPostData['hostName']) &&
|
||||
!empty($allPostData['dbUserName'])
|
||||
) {
|
||||
$connect = false;
|
||||
|
||||
$dbName = trim($allPostData['dbName']);
|
||||
|
||||
if (!str_contains($allPostData['hostName'], ':')) {
|
||||
$allPostData['hostName'] .= ":";
|
||||
}
|
||||
|
||||
[$hostName, $port] = explode(':', trim($allPostData['hostName']));
|
||||
|
||||
$dbUserName = trim($allPostData['dbUserName']);
|
||||
$dbUserPass = trim($allPostData['dbUserPass']);
|
||||
|
||||
if (!$port) {
|
||||
$port = null;
|
||||
}
|
||||
|
||||
$platform = $allPostData['dbPlatform'] ?? 'Mysql';
|
||||
|
||||
$databaseParams = [
|
||||
'platform' => $platform,
|
||||
'host' => $hostName,
|
||||
'port' => $port,
|
||||
'user' => $dbUserName,
|
||||
'password' => $dbUserPass,
|
||||
'dbname' => $dbName,
|
||||
];
|
||||
|
||||
$isConnected = true;
|
||||
|
||||
try {
|
||||
$installer->checkDatabaseConnection($databaseParams, true);
|
||||
} catch (\Exception $e) {
|
||||
$isConnected = false;
|
||||
$result['success'] = false;
|
||||
$result['errors']['dbConnect']['errorCode'] = $e->getCode();
|
||||
$result['errors']['dbConnect']['errorMsg'] = $e->getMessage();
|
||||
}
|
||||
|
||||
if ($isConnected) {
|
||||
$databaseRequiredList = $installer
|
||||
->getSystemRequirementList('database', true, ['databaseParams' => $databaseParams]);
|
||||
|
||||
foreach ($databaseRequiredList as $name => $details) {
|
||||
if (!$details['acceptable']) {
|
||||
switch ($details['type']) {
|
||||
case 'version':
|
||||
$result['success'] = false;
|
||||
$result['errors'][$name] = $details['required'];
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$result['success'] = false;
|
||||
$result['errors'][$name][] = $name;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
echo json_encode($result);
|
||||
49
install/core/actions/setupConfirmation.php
Normal file
49
install/core/actions/setupConfirmation.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$phpRequirementList = $installer->getSystemRequirementList('php');
|
||||
$smarty->assign('phpRequirementList', $phpRequirementList);
|
||||
|
||||
$installData = $_SESSION['install'];
|
||||
$hostData = explode(':', $installData['host-name']);
|
||||
|
||||
$dbConfig = [
|
||||
'host' => $hostData[0] ?? '',
|
||||
'port' => $hostData[1] ?? '',
|
||||
'dbname' => $installData['db-name'],
|
||||
'user' => $installData['db-user-name'],
|
||||
'password' => $installData['db-user-password'],
|
||||
'platform' => $installData['db-platform'] ?? null,
|
||||
];
|
||||
|
||||
$mysqlRequirementList = $installer->getSystemRequirementList('database', false, ['databaseParams' => $dbConfig]);
|
||||
$smarty->assign('mysqlRequirementList', $mysqlRequirementList);
|
||||
|
||||
$permissionRequirementList = $installer->getSystemRequirementList('permission');
|
||||
$smarty->assign('permissionRequirementList', $permissionRequirementList);
|
||||
49
install/core/actions/step1.php
Normal file
49
install/core/actions/step1.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$fields = array(
|
||||
'license-agree' => array(
|
||||
'default' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = (isset($fields[$fieldName]['default']))? $fields[$fieldName]['default'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('fields', $fields);
|
||||
|
||||
if (file_exists("LICENSE.txt")) {
|
||||
$license = file_get_contents('LICENSE.txt');
|
||||
$smarty->assign('license', $license);
|
||||
}
|
||||
81
install/core/actions/step2.php
Normal file
81
install/core/actions/step2.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$clearedCookieList = [
|
||||
'auth-token-secret',
|
||||
'auth-username',
|
||||
'auth-token',
|
||||
];
|
||||
|
||||
foreach ($clearedCookieList as $cookieName) {
|
||||
if (!isset($_COOKIE[$cookieName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
setcookie($cookieName, null, -1, '/');
|
||||
}
|
||||
|
||||
$config = $installer->getConfig();
|
||||
|
||||
$fields = [
|
||||
'db-platform' => [
|
||||
'default' => $config->get('database.platform', 'Mysql'),
|
||||
],
|
||||
'db-driver' => [
|
||||
'default' => $config->get('database.driver', ''),
|
||||
],
|
||||
'db-name' => [
|
||||
'default' => $config->get('database.dbname', ''),
|
||||
],
|
||||
'host-name' => [
|
||||
'default' => $config->get('database.host', '') .
|
||||
($config->get('database.port') ? ':' . $config->get('database.port') : ''),
|
||||
],
|
||||
'db-user-name' => [
|
||||
'default' => $config->get('database.user', ''),
|
||||
],
|
||||
'db-user-password' => [],
|
||||
];
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = $field['default'] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
$platforms = [
|
||||
'Mysql' => 'MySQL / MariaDB',
|
||||
'Postgresql' => 'PostgreSQL',
|
||||
];
|
||||
|
||||
$smarty->assign('platforms', $platforms);
|
||||
|
||||
$smarty->assign('fields', $fields);
|
||||
46
install/core/actions/step3.php
Normal file
46
install/core/actions/step3.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$fields = array(
|
||||
'user-name' => array(
|
||||
'default' => (isset($langs['labels']['admin']))? $langs['labels']['admin'] : 'admin',
|
||||
),
|
||||
'user-pass' => array(),
|
||||
'user-confirm-pass' => array(),
|
||||
);
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = (isset($fields[$fieldName]['default']))? $fields[$fieldName]['default'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('fields', $fields);
|
||||
72
install/core/actions/step4.php
Normal file
72
install/core/actions/step4.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$config = $installer->getConfig();
|
||||
$metadata = $installer->getMetadata();
|
||||
|
||||
$fields = [
|
||||
'dateFormat' => [
|
||||
'default' => $config->get('dateFormat'),
|
||||
'options' => $metadata->get(['app', 'dateTime', 'dateFormatList']) ?? [],
|
||||
],
|
||||
'timeFormat' => [
|
||||
'default'=> $config->get('timeFormat'),
|
||||
'options' => $metadata->get(['app', 'dateTime', 'timeFormatList']) ?? [],
|
||||
],
|
||||
'timeZone' => [
|
||||
'default'=> $config->get('timeZone', 'UTC'),
|
||||
],
|
||||
'weekStart' => [
|
||||
'default'=> $config->get('weekStart', 0),
|
||||
],
|
||||
'defaultCurrency' => [
|
||||
'default' => $config->get('defaultCurrency', 'USD'),
|
||||
],
|
||||
'thousandSeparator' => [
|
||||
'default' => $config->get('thousandSeparator', ','),
|
||||
],
|
||||
'decimalMark' => [
|
||||
'default' => $config->get('decimalMark', '.'),
|
||||
],
|
||||
'language' => [
|
||||
'default' => (!empty($_SESSION['install']['user-lang'])) ?
|
||||
$_SESSION['install']['user-lang'] :
|
||||
$config->get('language', 'en_US'),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = isset($field['default']) ? $field['default'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('fields', $fields);
|
||||
52
install/core/actions/step5.php
Normal file
52
install/core/actions/step5.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
$config = $installer->getConfig();
|
||||
|
||||
$fields = [
|
||||
'outboundEmailFromName' => [
|
||||
'default' => $config->get('outboundEmailFromName'),
|
||||
],
|
||||
'outboundEmailFromAddress' => [
|
||||
'default' => $config->get('outboundEmailFromAddress'),
|
||||
],
|
||||
'outboundEmailIsShared' => [
|
||||
'default' => $config->get('outboundEmailIsShared', false),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
$fields[$fieldName]['value'] = $_SESSION['install'][$fieldName];
|
||||
} else {
|
||||
$fields[$fieldName]['value'] = isset($field['default']) ? $field['default'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('fields', $fields);
|
||||
Reference in New Issue
Block a user