From 139991360639cfc04058140668bba7d70d554a3d Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Mon, 15 Sep 2014 12:35:32 +0300 Subject: [PATCH 1/6] fixed htaccess RedirectMatch 403 rule --- .htaccess | 27 +++++++++++++-------------- frontend/client/custom/.data | 1 + install/core/SystemHelper.php | 2 +- web.config | 16 ++++++++-------- 4 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 frontend/client/custom/.data diff --git a/.htaccess b/.htaccess index defe7f3b6c..db7778a520 100755 --- a/.htaccess +++ b/.htaccess @@ -4,23 +4,22 @@ DirectoryIndex index.php index.html -# PROTECTED DIRECTORIES RewriteEngine On - RewriteCond %{REQUEST_FILENAME} -d - RewriteRule (?i)(data|api) - [F] - -RedirectMatch 403 (?i)/data/config\.php$ -RedirectMatch 403 (?i)/data/logs -RedirectMatch 403 (?i)/data/cache -RedirectMatch 403 (?i)/data/upload -RedirectMatch 403 (?i)/application -RedirectMatch 403 (?i)/custom -RedirectMatch 403 (?i)/vendor -#END PROTECTED DIRECTORIES - - RewriteEngine On + # PROTECTED DIRECTORIES + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^/?(data|api)/ - [F] + + RewriteRule ^/?data/config\.php$ - [F] + RewriteRule ^/?data/logs/ - [F] + RewriteRule ^/?data/cache/ - [F] + RewriteRule ^/?data/upload/ - [F] + RewriteRule ^/?application/ - [F] + RewriteRule ^/?custom/ - [F] + RewriteRule ^/?vendor/ - [F] + #END PROTECTED DIRECTORIES + RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}] RewriteRule reset/?$ reset.html [QSA,L] diff --git a/frontend/client/custom/.data b/frontend/client/custom/.data new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/frontend/client/custom/.data @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/install/core/SystemHelper.php b/install/core/SystemHelper.php index 21da1c5b1f..aad7ee7554 100644 --- a/install/core/SystemHelper.php +++ b/install/core/SystemHelper.php @@ -279,7 +279,7 @@ class SystemHelper extends \Espo\Core\Utils\System $serverType = $this->getServerType(); $rules = array( - 'nginx' => "location /api/v1/ {\n if (!-e " . '$request_filename' . "){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}\n\nlocation /(data|api) {\n if (-e " . '$request_filename' . "){\n return 403;\n }\n}\n\nlocation /data/logs {\n return 403;\n}\nlocation /data/config.php$ {\n return 403;\n}\nlocation /data/cache {\n return 403;\n}\nlocation /data/upload {\n return 403;\n}\nlocation /application {\n return 403;\n}\nlocation /custom {\n return 403;\n}\nlocation /vendor {\n return 403;\n}", + 'nginx' => "location /api/v1/ {\n if (!-e " . '$request_filename' . "){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}\n\nlocation ^~ (data|api)/ {\n if (-e " . '$request_filename' . "){\n return 403;\n }\n}\n\nlocation ^~ /data/logs/ {\n return 403;\n}\nlocation ^~ /data/config.php {\n return 403;\n}\nlocation ^~ /data/cache/ {\n return 403;\n}\nlocation ^~ /data/upload/ {\n return 403;\n}\nlocation ^~ /application/ {\n return 403;\n}\nlocation ^~ /custom/ {\n return 403;\n}\nlocation ^~ /vendor/ {\n return 403;\n}", ); if (isset($rules[$serverType])) { diff --git a/web.config b/web.config index b82810acac..6baebe63d7 100644 --- a/web.config +++ b/web.config @@ -5,35 +5,35 @@ - + - + - + - + - + - + - + - + From 107584e0f903ab608e4dfec0e3346cc898310037 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Tue, 16 Sep 2014 11:35:38 +0300 Subject: [PATCH 2/6] DBAL: column length can be increased only --- .../Utils/Database/DBAL/Schema/Comparator.php | 110 +++++++++--------- 1 file changed, 58 insertions(+), 52 deletions(-) diff --git a/application/Espo/Core/Utils/Database/DBAL/Schema/Comparator.php b/application/Espo/Core/Utils/Database/DBAL/Schema/Comparator.php index 8f8b34abe6..4e9ee27a37 100644 --- a/application/Espo/Core/Utils/Database/DBAL/Schema/Comparator.php +++ b/application/Espo/Core/Utils/Database/DBAL/Schema/Comparator.php @@ -29,79 +29,85 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator { public function diffColumn(Column $column1, Column $column2) - { - $changedProperties = array(); - if ( $column1->getType() != $column2->getType() ) { + { + $changedProperties = array(); + if ( $column1->getType() != $column2->getType() ) { //espo: fix problem with executing query for custom types $column1DbTypeName = method_exists($column1->getType(), 'getDbTypeName') ? $column1->getType()->getDbTypeName() : $column1->getType()->getName(); $column2DbTypeName = method_exists($column2->getType(), 'getDbTypeName') ? $column2->getType()->getDbTypeName() : $column2->getType()->getName(); if (strtolower($column1DbTypeName) != strtolower($column2DbTypeName)) { - $changedProperties[] = 'type'; + $changedProperties[] = 'type'; } //END: espo - } + } - if ($column1->getNotnull() != $column2->getNotnull()) { - $changedProperties[] = 'notnull'; - } + if ($column1->getNotnull() != $column2->getNotnull()) { + $changedProperties[] = 'notnull'; + } - if ($column1->getDefault() != $column2->getDefault()) { - $changedProperties[] = 'default'; - } + if ($column1->getDefault() != $column2->getDefault()) { + $changedProperties[] = 'default'; + } - if ($column1->getUnsigned() != $column2->getUnsigned()) { - $changedProperties[] = 'unsigned'; - } + if ($column1->getUnsigned() != $column2->getUnsigned()) { + $changedProperties[] = 'unsigned'; + } - if ($column1->getType() instanceof \Doctrine\DBAL\Types\StringType) { - // check if value of length is set at all, default value assumed otherwise. - $length1 = $column1->getLength() ?: 255; - $length2 = $column2->getLength() ?: 255; - if ($length1 != $length2) { - $changedProperties[] = 'length'; - } + if ($column1->getType() instanceof \Doctrine\DBAL\Types\StringType) { + // check if value of length is set at all, default value assumed otherwise. + $length1 = $column1->getLength() ?: 255; + $length2 = $column2->getLength() ?: 255; - if ($column1->getFixed() != $column2->getFixed()) { - $changedProperties[] = 'fixed'; - } - } + /** Espo: column length can be increased only */ + /*if ($length1 != $length2) { + $changedProperties[] = 'length'; + }*/ + if ($length2 > $length1) { + $changedProperties[] = 'length'; + } + /** Espo: end */ - if ($column1->getType() instanceof \Doctrine\DBAL\Types\DecimalType) { - if (($column1->getPrecision()?:10) != ($column2->getPrecision()?:10)) { - $changedProperties[] = 'precision'; - } - if ($column1->getScale() != $column2->getScale()) { - $changedProperties[] = 'scale'; - } - } + if ($column1->getFixed() != $column2->getFixed()) { + $changedProperties[] = 'fixed'; + } + } - if ($column1->getAutoincrement() != $column2->getAutoincrement()) { - $changedProperties[] = 'autoincrement'; - } + if ($column1->getType() instanceof \Doctrine\DBAL\Types\DecimalType) { + if (($column1->getPrecision()?:10) != ($column2->getPrecision()?:10)) { + $changedProperties[] = 'precision'; + } + if ($column1->getScale() != $column2->getScale()) { + $changedProperties[] = 'scale'; + } + } - // only allow to delete comment if its set to '' not to null. - if ($column1->getComment() !== null && $column1->getComment() != $column2->getComment()) { - $changedProperties[] = 'comment'; - } + if ($column1->getAutoincrement() != $column2->getAutoincrement()) { + $changedProperties[] = 'autoincrement'; + } - $options1 = $column1->getCustomSchemaOptions(); - $options2 = $column2->getCustomSchemaOptions(); + // only allow to delete comment if its set to '' not to null. + if ($column1->getComment() !== null && $column1->getComment() != $column2->getComment()) { + $changedProperties[] = 'comment'; + } - $commonKeys = array_keys(array_intersect_key($options1, $options2)); + $options1 = $column1->getCustomSchemaOptions(); + $options2 = $column2->getCustomSchemaOptions(); - foreach ($commonKeys as $key) { - if ($options1[$key] !== $options2[$key]) { - $changedProperties[] = $key; - } - } + $commonKeys = array_keys(array_intersect_key($options1, $options2)); - $diffKeys = array_keys(array_diff_key($options1, $options2) + array_diff_key($options2, $options1)); + foreach ($commonKeys as $key) { + if ($options1[$key] !== $options2[$key]) { + $changedProperties[] = $key; + } + } - $changedProperties = array_merge($changedProperties, $diffKeys); + $diffKeys = array_keys(array_diff_key($options1, $options2) + array_diff_key($options2, $options1)); - return $changedProperties; - } + $changedProperties = array_merge($changedProperties, $diffKeys); + + return $changedProperties; + } } \ No newline at end of file From 91d4d9bcf9b528ff9dab6af36af91a9c14dfb823 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Tue, 16 Sep 2014 12:53:10 +0300 Subject: [PATCH 3/6] installer improvements --- install/core/Installer.php | 5 ++++ install/core/i18n/de_DE/install.json | 1 + install/core/i18n/en_US/install.json | 1 + install/core/i18n/es_ES/install.json | 1 + install/core/i18n/fr_FR/install.json | 1 + install/core/i18n/nl_NL/install.json | 1 + install/core/i18n/pl_PL/install.json | 1 + install/core/i18n/ro_RO/install.json | 1 + install/core/i18n/tr_TR/install.json | 1 + install/core/i18n/vi_VN/install.json | 1 + install/core/tpl/errors.tpl | 3 -- install/core/tpl/finish.tpl | 13 ++++----- install/core/tpl/header.tpl | 14 +++++++++- install/core/tpl/main.tpl | 16 ++++------- install/core/tpl/step1.tpl | 7 ++--- install/core/tpl/step2.tpl | 7 ++--- install/core/tpl/step3.tpl | 9 ++---- install/core/tpl/step4.tpl | 41 +++++++++++++--------------- install/core/tpl/step5.tpl | 39 ++++++++++++-------------- install/css/install.css | 21 +++++++++++++- install/index.php | 2 ++ 21 files changed, 105 insertions(+), 81 deletions(-) diff --git a/install/core/Installer.php b/install/core/Installer.php index d764e15e2a..67b0ec060f 100644 --- a/install/core/Installer.php +++ b/install/core/Installer.php @@ -94,6 +94,11 @@ class Installer return $this->app->getContainer()->get('fileManager'); } + public function getVersion() + { + return $this->getConfig()->get('version'); + } + protected function auth() { diff --git a/install/core/i18n/de_DE/install.json b/install/core/i18n/de_DE/install.json index fe6a3d3f38..f58e194158 100644 --- a/install/core/i18n/de_DE/install.json +++ b/install/core/i18n/de_DE/install.json @@ -25,6 +25,7 @@ "Next": "Weiter", "Go to EspoCRM": "Zu EspoCRM", "Re-check": "Überprüfung wiederholen", + "Version": "Version", "Test settings": "Verbindung überprüfen", "Database Settings Description": "Geben Sie die Verbindungsinformationen für Ihre MySQL Datebank ein (Hostname, Benutzername und Passwort). Sie können den Serverport z.B. so definieren: localhost:3306" }, diff --git a/install/core/i18n/en_US/install.json b/install/core/i18n/en_US/install.json index 57915a4804..726f9a999f 100644 --- a/install/core/i18n/en_US/install.json +++ b/install/core/i18n/en_US/install.json @@ -25,6 +25,7 @@ "Next": "Next", "Go to EspoCRM": "Go to EspoCRM", "Re-check": "Re-check", + "Version": "Version", "Test settings": "Test Connection", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/es_ES/install.json b/install/core/i18n/es_ES/install.json index 24e90a08ee..11ae7b8ff9 100644 --- a/install/core/i18n/es_ES/install.json +++ b/install/core/i18n/es_ES/install.json @@ -24,6 +24,7 @@ "Next": "Siguiente", "Go to EspoCRM": "Ir a EspoCRM(Español)", "Re-check": "Revisar otra vez", + "Version": "Version", "Test settings": "Test de conexión", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/fr_FR/install.json b/install/core/i18n/fr_FR/install.json index c9da6be879..e658351ad3 100644 --- a/install/core/i18n/fr_FR/install.json +++ b/install/core/i18n/fr_FR/install.json @@ -25,6 +25,7 @@ "Next": "Suivant", "Go to EspoCRM": "Aller à EspoCRM", "Re-check": "Revérifier", + "Version": "Version", "Test settings": "Tester la Connexion", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/nl_NL/install.json b/install/core/i18n/nl_NL/install.json index 23c3a74ecc..2a48121d5c 100644 --- a/install/core/i18n/nl_NL/install.json +++ b/install/core/i18n/nl_NL/install.json @@ -25,6 +25,7 @@ "Next": "Volgende", "Go to EspoCRM": "Ga naar EspoCRM", "Re-check": "Re-check", + "Version": "Versie", "Test settings": "Test Verbinding", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/pl_PL/install.json b/install/core/i18n/pl_PL/install.json index a1deaa4628..4af6f65bcf 100644 --- a/install/core/i18n/pl_PL/install.json +++ b/install/core/i18n/pl_PL/install.json @@ -25,6 +25,7 @@ "Next": "Następny", "Go to EspoCRM": "Idź do EspoCRM", "Re-check": "Sprawdź jeszcze raz", + "Version": "Wersja", "Test settings": "Test połączenia z bazą danych", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/ro_RO/install.json b/install/core/i18n/ro_RO/install.json index b5fddb0377..ba1fa882ff 100644 --- a/install/core/i18n/ro_RO/install.json +++ b/install/core/i18n/ro_RO/install.json @@ -25,6 +25,7 @@ "Next": "Inainte", "Go to EspoCRM": "Mergi la EspoCRM", "Re-check": "Re-verificare", + "Version": "Versiunea", "Test settings": "Testare Conexiune", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/i18n/tr_TR/install.json b/install/core/i18n/tr_TR/install.json index 184ca85a22..a682174600 100644 --- a/install/core/i18n/tr_TR/install.json +++ b/install/core/i18n/tr_TR/install.json @@ -25,6 +25,7 @@ "Next": "Sonraki", "Go to EspoCRM": "EspoCRM sayfama git", "Re-check": "Tekrar Kontrol Et", + "Version": "Versiyon", "Test settings": "Bağlantıyı Kontrol Et" }, "fields": { diff --git a/install/core/i18n/vi_VN/install.json b/install/core/i18n/vi_VN/install.json index 4c6eebbc3b..e3ed102324 100644 --- a/install/core/i18n/vi_VN/install.json +++ b/install/core/i18n/vi_VN/install.json @@ -25,6 +25,7 @@ "Next": "Tiến", "Go to EspoCRM": "Đi đến EspoCRM", "Re-check": "Kiểm tra lại", + "Version": "Phiên bản", "Test settings": "Kiểm tra kết nối", "Database Settings Description": "Enter your MySQL database connection information (hostname, username and password). You can specify the server port for hostname like localhost:3306." }, diff --git a/install/core/tpl/errors.tpl b/install/core/tpl/errors.tpl index cea6682339..a0c1383138 100644 --- a/install/core/tpl/errors.tpl +++ b/install/core/tpl/errors.tpl @@ -1,6 +1,3 @@ -
-

{$langs['labels']['Errors page title']}

-
{$errors}
diff --git a/install/core/tpl/finish.tpl b/install/core/tpl/finish.tpl index 8140e035d1..e791c1adc4 100644 --- a/install/core/tpl/finish.tpl +++ b/install/core/tpl/finish.tpl @@ -1,6 +1,3 @@ -
-

{$langs['labels']['Finish page title']}

-
+
+
+
+

+ {$langs['labels']["{$action} page title"]} +

+
+
+ {$langs['labels']['Version']} {$version} +
+
+
\ No newline at end of file diff --git a/install/core/tpl/main.tpl b/install/core/tpl/main.tpl index fa2ded5bb8..6927634fc1 100644 --- a/install/core/tpl/main.tpl +++ b/install/core/tpl/main.tpl @@ -1,16 +1,13 @@ -
-

{$langs['labels']['Main page title']}

-
-
+
-
- EspoCRM -
- {$langs['labels']['Main page header']} +
+ EspoCRM +
+ {$langs['labels']['Main page header']}
@@ -34,8 +31,7 @@
- - +
\ No newline at end of file diff --git a/install/core/tpl/step3.tpl b/install/core/tpl/step3.tpl index f7e080be98..020161ecf4 100644 --- a/install/core/tpl/step3.tpl +++ b/install/core/tpl/step3.tpl @@ -37,7 +37,6 @@
-