diff --git a/install/core/SystemHelper.php b/install/core/SystemHelper.php
index c39dcf6277..187e493ef6 100644
--- a/install/core/SystemHelper.php
+++ b/install/core/SystemHelper.php
@@ -122,6 +122,10 @@ class SystemHelper extends \Espo\Core\Utils\System
protected function getMysqlSetting($name, \PDO $pdoConnection)
{
+ if (!method_exists($pdoConnection, 'prepare')) {
+ return null;
+ }
+
$sth = $pdoConnection->prepare("SHOW VARIABLES LIKE '" . $name . "'");
$sth->execute();
$res = $sth->fetch(PDO::FETCH_NUM);
diff --git a/install/core/Utils.php b/install/core/Utils.php
new file mode 100644
index 0000000000..164a07e9bc
--- /dev/null
+++ b/install/core/Utils.php
@@ -0,0 +1,46 @@
+getFileList($actionPath);
+
+ foreach ($actionList as $fileName) {
+ $fileRealPath = realpath($actionPath . '/' . $fileName);
+
+ if ($fileRealPath === $actionRealPath) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/install/core/actions/errors.php b/install/core/actions/errors.php
index d6473a18f9..1ca3efe6ed 100644
--- a/install/core/actions/errors.php
+++ b/install/core/actions/errors.php
@@ -20,8 +20,4 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
-$errors = array();
-if (!empty($_REQUEST['desc'])) {
- $errors = str_replace('^^', '
', $_REQUEST['desc']);
- $smarty->assign('errors', $errors);
-}
\ No newline at end of file
+
diff --git a/install/core/actions/setupConfirmation.php b/install/core/actions/setupConfirmation.php
index fa9b28d3bf..c5edb20093 100644
--- a/install/core/actions/setupConfirmation.php
+++ b/install/core/actions/setupConfirmation.php
@@ -24,18 +24,18 @@ $phpConfig = $systemHelper->getRecommendationList();
$smarty->assign('phpConfig', $phpConfig);
$installData = $_SESSION['install'];
-list($host, $port) = explode(':', $installData['hostName']);
+list($host, $port) = explode(':', $installData['host-name']);
$dbConfig = array(
'dbHostName' => $host,
'dbPort' => $port,
- 'dbName' => $installData['dbName'],
- 'dbUserName' => $installData['dbUserName'],
- 'dbUserPass' => $installData['dbUserPass'],
+ 'dbName' => $installData['db-name'],
+ 'dbUserName' => $installData['db-user-name'],
+ 'dbUserPass' => $installData['db-user-password'],
);
$mysqlConfig = $systemHelper->getRecommendationList('mysql', $dbConfig);
-$dbConfig['dbHostName'] = $installData['hostName'];
+$dbConfig['dbHostName'] = $installData['host-name'];
unset($dbConfig['dbPort'], $dbConfig['dbUserPass']);
foreach ($dbConfig as $name => $value) {
diff --git a/install/core/tpl/errors.tpl b/install/core/tpl/errors.tpl
index da505006dc..0a9ca49378 100644
--- a/install/core/tpl/errors.tpl
+++ b/install/core/tpl/errors.tpl
@@ -27,6 +27,8 @@
}
{literal}
var installScript = new InstallScript(opt);
+ installScript.showLoading();
+ installScript.actionsChecking();
})
{/literal}
diff --git a/install/index.php b/install/index.php
index 3fdba9b1f1..17154f899e 100644
--- a/install/index.php
+++ b/install/index.php
@@ -24,14 +24,21 @@ session_start();
require_once('../bootstrap.php');
+//action
+$action = (!empty($_POST['action']))? $_POST['action'] : 'main';
+require_once('core/Utils.php');
+if (!Utils::isActionExists($action)) {
+ die('This page does not exist.');
+}
// temp save all settings
-$ignore = array('desc', 'dbName', 'hostName', 'dbUserName', 'dbUserPass', 'dbDriver');
+$ignoredFields = array('installProcess', 'dbName', 'hostName', 'dbUserName', 'dbUserPass', 'dbDriver');
-if (!empty($_REQUEST)) {
- foreach ($_REQUEST as $key => $val) {
- if (!in_array($val, $ignore))
- $_SESSION['install'][$key] = trim($val);
+if (!empty($_POST)) {
+ foreach ($_POST as $key => $val) {
+ if (!in_array($key, $ignoredFields)) {
+ $_SESSION['install'][$key] = trim($val);
+ }
}
}
@@ -59,6 +66,7 @@ if (!$systemHelper->initWritable()) {
require_once ('install/vendor/smarty/libs/Smarty.class.php');
require_once 'core/Installer.php';
+require_once 'core/Utils.php';
$smarty = new Smarty();
$installer = new Installer();
@@ -85,11 +93,6 @@ $smarty->assign("langs", $langs);
$smarty->assign("langsJs", json_encode($langs));
// include actions and set tpl name
-$tplName = 'main.tpl';
-$actionsDir = 'core/actions';
-$actionFile = '';
-$action = (!empty($_REQUEST['action']))? $_REQUEST['action'] : 'main';
-
switch ($action) {
case 'main':
$languageList = $installer->getLanguageList();
@@ -119,7 +122,7 @@ switch ($action) {
break;
}
-$actionFile = $actionsDir.'/'.$action.'.php';
+$actionFile = 'core/actions/'.$action.'.php';
$tplName = $action.'.tpl';
$smarty->assign('tplName', $tplName);
$smarty->assign('action', ucfirst($action));
@@ -128,7 +131,7 @@ $smarty->assign('action', ucfirst($action));
$config = include('core/config.php');
$smarty->assign('config', $config);
-if (!empty($actionFile) && file_exists('install/'.$actionFile)) {
+if (Utils::isActionExists($action)) {
include $actionFile;
}
diff --git a/install/js/install.js b/install/js/install.js
index 95ecdab2d6..171ff4ec0f 100644
--- a/install/js/install.js
+++ b/install/js/install.js
@@ -514,18 +514,12 @@ InstallScript.prototype.validate = function() {
return valid;
}
-
InstallScript.prototype.setForm = function(opt) {
var formId = opt.formId || 'nav';
var action = opt.action || 'main';
- var desc = opt.desc || '';
var actionField = $('', {'name': 'action', 'value': action, 'type': 'hidden'});
$('#'+formId).append(actionField);
- var descField = $('