CVE-2023-1070: External Control of File Name or Path (CWE-73)
value: External Control of File Name or Path in GitHub repository nilsteampassnet/teampass prior to 3.0.0.22.
CWE description: The product allows user input to control or influence paths or file names that are used in filesystem operations.
CVSS v3 base score: 7.1
Published: 2023-02-27T16:15Z
Repository: https://github.com/nilsteampassnet/teampass
Language: PHP
Files changed: api/Model/ItemModel.php, includes/config/include.php, includes/core/load.js.php, includes/core/login.js.php, includes/core/login.php, includes/core/logout.php, includes/core/otv.php, includes/language/arabic.php, includes/language/bulgarian.php, includes/language/catalan.php, includes/language/chinese.php, includes/language/czech.php, includes/language/dutch.php, includes/language/english.php, includes/language/estonian.php, includes/language/french.php, includes/language/german.php, includes/language/greek.php, includes/language/hungarian.php, includes/language/italian.php, includes/language/japanese.php, includes/language/norwegian.php, includes/language/polish.php, includes/language/portuguese.php, includes/language/portuguese_br.php, includes/language/romanian.php, includes/language/russian.php, includes/language/spanish.php, includes/language/swedish.php, includes/language/turkish.php, includes/language/ukrainian.php, includes/language/vietnamese.php, index.php, install/install.php, install/install.queries.php, install/migrate_users_to_v3.php, install/tp.functions.php, install/upgrade.php, install/upgrade_ajax.php, install/upgrade_run_3.0.0.php, install/upgrade_run_3.0.0_fields.php, install/upgrade_run_3.0.0_files.php, install/upgrade_run_3.0.0_logs.php, install/upgrade_run_3.0.0_passwords.php, install/upgrade_run_3.0.0_suggestions.php, install/upgrade_run_3.0.0_users.php, install/upgrade_scripts_manager.php, pages/2fa.js.php, pages/2fa.php, pages/actions.js.php, pages/actions.php, pages/admin.js.php, pages/admin.php, pages/api.js.php, pages/api.php, pages/backups.js.php, pages/backups.php, pages/emails.js.php, pages/emails.php, pages/export.js.php, pages/export.php, pages/favorites.js.php, pages/favourites.php, pages/fields.js.php, pages/fields.php, pages/folders.js.php, pages/folders.php, pages/import.js.php, pages/import.php, pages/items.js.php, pages/items.php, pages/kb.php, pages/ldap.js.php, pages/ldap.php, pages/offline.js.php, pages/offline.php, pages/options.js.php, pages/options.php, pages/profile.js.php, pages/profile.php, pages/roles.js.php, pages/roles.php, pages/search.js.php, pages/search.php, pages/special.php, pages/statistics.js.php, pages/statistics.php, pages/suggestion.php, pages/tasks.js.php, pages/tasks.php, pages/uploads.js.php, pages/uploads.php, pages/users.js.php, pages/users.php, pages/utilities.database.js.php, pages/utilities.database.php, pages/utilities.deletion.js.php, pages/utilities.deletion.php, pages/utilities.logs.js.php, pages/utilities.logs.php, pages/utilities.php, pages/utilities.renewal.js.php, pages/utilities.renewal.php, sources/admin.queries.php, sources/aes.functions.php, sources/background.php, sources/backups.queries.php, sources/checks.php, sources/core.php, sources/downloadFile.php, sources/expired.datatables.php, sources/export.queries.php, sources/favourites.queries.php, sources/fields.queries.php, sources/find.queries.php, sources/folders.datatable.php, sources/folders.queries.php, sources/identify.php, sources/import.queries.php, sources/items.logs.php, sources/items.queries.php, sources/ldap.queries.php, sources/logs.datatables.php, sources/main.functions.php, sources/main.queries.php, sources/roles.queries.php, sources/scheduler.php, sources/tree.php, sources/upload.attachments.php, sources/upload.files.php, sources/user.logs.datatables.php, sources/users.datatable.php, sources/users.queries.php, sources/utilities.queries.php, sources/utils.queries.php
Commit date: 2023-02-14 08:01:35 +0100
Commit message: 3.0.0.23

Fix for #3520
Fix vulnerability related to teampass-seckey.txt file

Diff: diff --git a/api/Model/ItemModel.php b/api/Model/ItemModel.php
index a27cb749..75c2a821 100755
--- a/api/Model/ItemModel.php
+++ b/api/Model/ItemModel.php
@@ -75,11 +75,11 @@ class ItemModel extends Database
             $path = '';
             foreach ($arbo as $elem) {
                 if (empty($path) === true) {
                     $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
                 } else {
-                    $path .= '>' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
+                    $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
                 }
             }
 
             array_push(
                 $ret,
diff --git a/includes/config/include.php b/includes/config/include.php
index bb864273..279fbeea 100755
--- a/includes/config/include.php
+++ b/includes/config/include.php
@@ -10,16 +10,16 @@
  *
  * @author    Nils Laumaillé <nils@teampass.net>
  * @copyright 2009-2022 Nils Laumaillé
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
  *
- * @version   3.0.0.22
+ * @version   3.0.0.23
  *
  * @see      http://www.teampass.net
  */
 define('TP_VERSION', '3.0.0');
-define('TP_VERSION_FULL', TP_VERSION.'.22');
+define('TP_VERSION_FULL', TP_VERSION.'.23');
 define('TP_TOOL_NAME', 'Teampass');
 define('TP_ONE_DAY_SECONDS', 86400);
 define('TP_ONE_WEEK_SECONDS', 604800);
 define('TP_ONE_MONTH_SECONDS', 2592000);
 define('TP_IMAGE_FILE_EXT', array('jpg', 'gif', 'png', 'jpeg', 'tiff', 'bmp'));
diff --git a/includes/core/load.js.php b/includes/core/load.js.php
index 411b35be..62627c37 100755
--- a/includes/core/load.js.php
+++ b/includes/core/load.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      load.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/includes/core/login.js.php b/includes/core/login.js.php
index e5200efd..e55f5dbb 100755
--- a/includes/core/login.js.php
+++ b/includes/core/login.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      login.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/includes/core/login.php b/includes/core/login.php
index cb2cbd36..b686cad9 100755
--- a/includes/core/login.php
+++ b/includes/core/login.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      login.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/includes/core/logout.php b/includes/core/logout.php
index 2a22a329..a68b1821 100755
--- a/includes/core/logout.php
+++ b/includes/core/logout.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      logout.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/includes/core/otv.php b/includes/core/otv.php
index 7aac8719..1db3f186 100755
--- a/includes/core/otv.php
+++ b/includes/core/otv.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      otv.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/includes/language/arabic.php b/includes/language/arabic.php
index 61ab01e7..988b9b42 100755
--- a/includes/language/arabic.php
+++ b/includes/language/arabic.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      arabic.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009 - 2022 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/bulgarian.php b/includes/language/bulgarian.php
index f83818d2..ebfc106c 100755
--- a/includes/language/bulgarian.php
+++ b/includes/language/bulgarian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      bulgarian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/catalan.php b/includes/language/catalan.php
index d6bbfc6d..543e305e 100755
--- a/includes/language/catalan.php
+++ b/includes/language/catalan.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      catalan.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/chinese.php b/includes/language/chinese.php
index 118ae26c..ea20ac1e 100755
--- a/includes/language/chinese.php
+++ b/includes/language/chinese.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      chinese.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/czech.php b/includes/language/czech.php
index 8f129f86..b16a1227 100755
--- a/includes/language/czech.php
+++ b/includes/language/czech.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      czech.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/dutch.php b/includes/language/dutch.php
index a74fcda0..0fcb1450 100755
--- a/includes/language/dutch.php
+++ b/includes/language/dutch.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      dutch.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/english.php b/includes/language/english.php
index a3ecb131..f931586d 100755
--- a/includes/language/english.php
+++ b/includes/language/english.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      english.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009 - 2022 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -515,11 +515,11 @@ return array(
     'admin_ga_website_name' => 'Name displayed in Google 2-step Verification for Teampass',
     'admin_ga_website_name_tip' => 'This name is used for the identification code account in Google 2-step Verification.',
     'api_whitelist_ips' => 'API IPs Whitelist',
     'api_whitelist_ips_tip' => 'If no API client IP addresses are explicitly listed here, then any IP address is authorized.',
     'email_share_item_subject' => 'A password item was shared with you',
-    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href=\'#tp_link#\'>Click this link</a> to access the item.<br><br><br>Greetings',
+    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href="#tp_link#">Click this link</a> to access the item.<br><br><br>Greetings',
     'index_maintenance_mode_admin' => 'Maintenance mode is enabled. Users cannot sign in.',
     '2fa_authentication_selector' => 'Select a 2 factor authentication method',
     'upload_empty_file' => 'Upload empty file',
     'upload_any_extension_file' => 'Upload any extension file',
     'upload_any_extension_file_tip' => 'When enabled, this option will allow users to upload any kind of files.',
diff --git a/includes/language/estonian.php b/includes/language/estonian.php
index d18c347f..03f63b6a 100755
--- a/includes/language/estonian.php
+++ b/includes/language/estonian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      estonian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/french.php b/includes/language/french.php
index 80f40c6a..88c18377 100755
--- a/includes/language/french.php
+++ b/includes/language/french.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      french.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/german.php b/includes/language/german.php
index 5137fd62..b7716bb2 100755
--- a/includes/language/german.php
+++ b/includes/language/german.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      german.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/greek.php b/includes/language/greek.php
index 17115e3e..b4cb1bf6 100755
--- a/includes/language/greek.php
+++ b/includes/language/greek.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      greek.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/hungarian.php b/includes/language/hungarian.php
index c6034ec6..febe08b4 100755
--- a/includes/language/hungarian.php
+++ b/includes/language/hungarian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      hungarian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/italian.php b/includes/language/italian.php
index e6cecb54..17c90e7b 100755
--- a/includes/language/italian.php
+++ b/includes/language/italian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      italian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/japanese.php b/includes/language/japanese.php
index 52402c81..2511964a 100755
--- a/includes/language/japanese.php
+++ b/includes/language/japanese.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      japanese.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/norwegian.php b/includes/language/norwegian.php
index df2c2aaa..a294588a 100755
--- a/includes/language/norwegian.php
+++ b/includes/language/norwegian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      norwegian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/polish.php b/includes/language/polish.php
index f1f4b3f9..740c82b7 100755
--- a/includes/language/polish.php
+++ b/includes/language/polish.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      polish.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/portuguese.php b/includes/language/portuguese.php
index 8416aebe..d5b89c25 100755
--- a/includes/language/portuguese.php
+++ b/includes/language/portuguese.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      portuguese.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -63,35 +63,35 @@ return array(
     'error' => 'Error caught',
     'hosts' => 'Hosts',
     'settings_ldap_hosts_tip' => 'The hosts option is an array of IP addresses or host names located on your network that serve an LDAP directory (seprated by a comma). You insert as many servers or as little as you would like depending on your forest (with the minimum of one of course).',
     'base_distiguished_name' => 'Base DN',
     'settings_ldap_bdn_tip' => 'The root distinguished name (DN) to use when running queries against the directory server. Examples: o=example,c=com ; cn=users,dc=ad,dc=example,dc=com',
-    'username' => 'Username',
+    'username' => 'Utilizador',
     'settings_ldap_username_tip' => 'The distinguished name of the user that the application will use when connecting to the directory server. Examples: cn=administrator,cn=users,dc=ad,dc=example,dc=com ; cn=user,dc=domain,dc=name',
-    'settings_ldap_password_tip' => 'The password of the user specified above.',
+    'settings_ldap_password_tip' => 'A palavra-passe do utilizador especificado acima.',
     'settings_ldap_port_tip' => 'Default non secure LDAP port: 389, default secure LDAP port: 636',
-    'undefined' => 'Undefined',
-    'error_cannot_open_file' => 'File cannot be opened',
+    'undefined' => 'Indefinido',
+    'error_cannot_open_file' => 'O ficheiro não pode ser aberto',
     'provide_current_psk_and_click_launch' => 'When ready, click button Launch',
-    'start' => 'Start',
+    'start' => 'Iniciar',
     'data_inconsistency' => 'Data inconsistency found. Please reload the page!',
     'one_time_code_expected' => 'One-Time-Code expected',
     'data_are_missing' => 'Expected data are missing',
     'one_time_code' => 'One-Time-Code',
     'provide_personal_one_time_code' => 'Please provide the One-Time-Code you received by email',
     'change_authentification_type_to_ldap' => 'Change authentication type to LDAP',
     'change_authentification_type_to_local' => 'Change authentication type to Teampass local database',
     'ldap_user_password_is_used_for_authentication' => 'User password in LDAP is used for authentication',
     'local_user_password_is_used_for_authentication' => 'User password in Teampass is used for authentication',
     'provide_your_current_password' => 'Provide your current password',
-    'current_password' => 'Current password',
-    'password_is_not_correct' => 'This password is not correct',
+    'current_password' => 'Palavra-passe atual',
+    'password_is_not_correct' => 'Esta palavra-passe não é a correta',
     'ldap_password_change_warning' => 'Your login password has changed since last connection. It is requested to re-encrypt all the keys using this new password. For this operation, please fill in the next field with your previous ldap password. The operation can take several minutes.',
-    'personal_items' => 'Personal items',
+    'personal_items' => 'Itens pessoais',
     'logout_on_going' => 'You will now be logout. Use your new password for being connected from now.',
     'fill_in_fields_and_hit_launch' => 'Provide expected data and hit Launch button',
-    'please_select_a_folder' => 'Please select a folder',
+    'please_select_a_folder' => 'Por favor seleccione uma pasta',
     'user_must_have_login_and_email' => 'User must have a login and an email',
     'user_has_this_role_in_teampass' => 'O utilizador tem esta função no Teampass',
     'select_role_to_create' => 'Seleccione função a criar',
     'adding_ldap_role_to_teampass' => 'Pode decidir criar uma função no Teampass a partir da Active Directory. Isto vai permitir associar o utilizador a esta função no Teampass.',
     'add_user_to_role' => 'Adicione esta função ao utilizador no Teampass',
@@ -99,18 +99,18 @@ return array(
     'synchronized' => 'Synchronized',
     'output' => 'Output',
     'remove_install_folder' => 'Install folder has to be removed',
     'list_users' => 'List users',
     'ldap_synchronization' => 'LDAP synchronization',
-    'in_progress' => 'In progress',
+    'in_progress' => 'Em progresso',
     'clipboard_password_life_duration' => 'Delay before the clipboard is cleared (in seconds)',
     'clipboard_password_life_duration_tip' => 'Permits to define a delay in seconds before which the password copied in clipboard will be cleared from the browser clipboard. Set to 0 to disable.',
     'clipboard_will_be_cleared' => 'Password is now in clipboard. It will soon be cleared...',
     'file_folder_not_accessible' => 'Files folder is not accessible',
     'error_missing_id' => 'An error occurred. Missing ID ... ?',
     'error_folder_not_allowed' => 'Selected folder is not allowed',
-    'all_fields_mandatory' => 'All fields are mandatory',
+    'all_fields_mandatory' => 'Todos os campos são obrigatórios',
     'history_insert_entry' => 'Insert in History',
     'clear_form' => 'Clear form',
     'info_about_history_insertion' => 'Caution - This feature permits you to insert manually an event in the item history log. Once added it will not be possible to remove it. Also notice that your account id will be associated to this new entry.',
     'select_all' => 'Selecionar todos',
     'unselect_all' => 'Unselect all',
@@ -124,18 +124,18 @@ return array(
     'loading_data' => 'Loading data',
     'password_overview_delay' => 'Delay for password overview',
     'password_overview_delay_tip' => 'This setting permits to define the number of seconds the clear password will be displayed to the user.',
     'select_date_showing_items_expiration' => 'List the expired items at date',
     'renewal_page_info' => 'This page permits to identify the items currently expired or expiring in next period.',
-    'filename' => 'Filename',
-    'exported_to_file' => 'Exported to file',
-    'operation_progress' => 'Operation is in progress',
-    'exporting_items' => 'Exporting items',
-    'select_folders_to_export' => 'Select folders to export',
-    'export_format_type' => 'Select the export format type',
-    'export_items' => 'Export items',
-    'loading_item' => 'Loading item',
+    'filename' => 'Nome do ficheiro',
+    'exported_to_file' => 'Exportado para ficheiro',
+    'operation_progress' => 'A operação está em progresso',
+    'exporting_items' => 'A exportar itens',
+    'select_folders_to_export' => 'Seleccione pastas para exportar',
+    'export_format_type' => 'Seleccione o formato de exportação',
+    'export_items' => 'Exportar itens',
+    'loading_item' => 'A carregar item',
     'otv_message' => 'You can share this item with someone without a Teampass account. One-Time-View permits your guest to access basic fields of this item only once without being authenticated in Teampass. Please notice that this link is valid for a period of ##otv_expiration_period##  days. Copy and share the link below.',
     'no_sharekey_found' => 'No key found for this file and your account',
     'otv_link' => 'One-time-view link',
     'one_time_view' => 'One-time-view',
     'move_right_columns_separator' => 'Move columns separator Right',
@@ -497,11 +497,11 @@ return array(
     'settings_item_extra_fields_tip' => 'Enables another tab when creating password items, which contains custom fields for other types of data. An administrator must first create categories and the custom field labels to be displayed in those categories. This feature consumes more server resources.',
     'settings_ldap_type' => 'LDAP server type',
     'server_time' => 'Server time',
     'settings_tree_counters' => 'Show more counters in folder tree',
     'settings_tree_counters_tip' => 'Enabling shows three numbers next to each folder: number of items in base folder; number of items including subfolders; number of subfolders. Enabling this feature may slow loading of the folder tree pane.',
-    'admin_action_check_pf' => 'Criar pastas pessoas para todos os utilizadores que não têm',
+    'admin_action_check_pf' => 'Criar pastas pessoas para todos os utilizadores que não as têm',
     'enable_personal_folder_feature_tip' => 'Personal folders are a private location for individual user passwords. Password items are encrypted by a user\'s salt key (more secure) or by their password (easier). Enabling this feature does not create the actual folders for existing users - you must also run the create personal folders task.',
     'administrators_only' => 'Administrators only',
     'managers_of' => 'Gestores da função',
     'managed_by' => 'Managed by',
     'settings_enable_sts' => 'HTTPS Strict Transport Security (HSTS) <strong>Warning</strong>: read tooltip!',
@@ -722,11 +722,11 @@ return array(
     'last_items_title' => 'Ultimo item visto',
     'ldap_extension_not_loaded' => 'A extensão LDAP não esta ativado no servidor',
     'level' => 'Nivel',
     'login' => 'Login (se necessário)',
     'mask_pw' => 'Oculta/Mostra a senha',
-    'max_last_items' => 'Maximo de últimos itens visto por um usuários (Padrão é 10)',
+    'max_last_items' => 'Tamanho da lista dos últimos itens vistos (padrão é 10)',
     'minutes' => 'minutos',
     'name' => 'Nome',
     'nb_false_login_attempts' => 'Número de tentativas de login sem sucesso para bloquear a conta (0 é desativado)',
     'nb_folders' => 'Número da pastas',
     'nb_items' => 'Número de itens',
@@ -735,18 +735,18 @@ return array(
     'none' => 'Nenhum',
     'none_selected_text' => 'Nenhum selecionado',
     'not_allowed_to_see_pw' => 'Você não esta autorizado a ver este item!',
     'not_allowed_to_see_pw_is_expired' => 'Este item esta expirado',
     'not_defined' => 'Não definido',
-    'number_of_used_pw' => 'Número de novas senhas que o usuário precisa ingressar antes de usar uma senha antiga',
+    'number_of_used_pw' => 'Número de palavras-passe antigas guardadas para evitar reutilização (0 para desativar)',
     'pages' => 'Paginas',
     'pdf_download' => 'Dowload do arquivo',
     'personal_salt_key' => 'Sua senha pessoal \'SALT KEY\'',
     'pw' => 'Senha',
     'pw_generate' => 'Gera',
     'pw_is_expired_-_update_it' => 'Este item expirou! Precisa alterar a senha.',
-    'pw_life_duration' => 'Vida útil da senha de um usuário para expirar (em dia, 0 para desativar)',
+    'pw_life_duration' => 'Palavras-passe de sessão expiram ao fim de xx dias (0 para desativar)',
     'readme_open' => 'Abrir o arquivo README completo',
     'read_only_account' => 'Somente Leitura',
     'restore' => 'Recuperar',
     'restricted_to' => 'Restrito para',
     'restricted_to_roles' => 'Ativa itens restritos para funções e utilizadores',
@@ -765,11 +765,11 @@ return array(
     'settings_ldap_mode' => 'Ativa autenticação dos utilizadores por LDAP',
     'settings_ldap_mode_tip' => 'Ativar apenas se quiser usar um servidor LDAP em vez da base de dados interna do Teampass.',
     'settings_ldap_ssl' => 'Usar SSL (LDAPS)',
     'settings_ldap_tls' => 'Use LDAP a traves de TLS',
     'settings_log_accessed' => 'Ativa registros de quem acessou aos itens',
-    'settings_log_connections' => 'Guarda todos os inícios de sessão',
+    'settings_log_connections' => 'Guarda registo de todos os inícios de sessão',
     'settings_maintenance_mode' => 'Coloca TeamPass em modo de manutenção',
     'settings_manager_edit' => 'Os Gerenciadores podem editar e apagar itens que estão autorizados a ver',
     'settings_printing' => 'Habilita a opção de imprimir arquivos PDF',
     'settings_printing_tip' => 'Quando ativado, um botão será adicionado à página home do usuário que permita que ele / ela escrever uma lista de itens para um arquivo PDF ele / ela pode ver. Observe que as senhas serão listados DESCRIPTOGRAFADAS. (não é seguro ativar)',
     'settings_restricted_to' => 'Habilita funções restritas para os itens',
diff --git a/includes/language/portuguese_br.php b/includes/language/portuguese_br.php
index 184540e3..a4af6eaf 100755
--- a/includes/language/portuguese_br.php
+++ b/includes/language/portuguese_br.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      portuguese_br.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/romanian.php b/includes/language/romanian.php
index c407889b..b546895e 100755
--- a/includes/language/romanian.php
+++ b/includes/language/romanian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      romanian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/russian.php b/includes/language/russian.php
index f6a2df46..c294ee60 100755
--- a/includes/language/russian.php
+++ b/includes/language/russian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      russian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/spanish.php b/includes/language/spanish.php
index e7f05a5b..9a708015 100755
--- a/includes/language/spanish.php
+++ b/includes/language/spanish.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      spanish.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -445,11 +445,11 @@ return array(
     'admin_ga_website_name' => 'Nombre mostrado en Google Authenticator para Teampass',
     'admin_ga_website_name_tip' => 'Este nombre se utiliza para la cuenta de código de identificación en Google Authenticator.',
     'api_whitelist_ips' => 'Lista blanca de IPs de la API',
     'api_whitelist_ips_tip' => 'Si no hay direcciones IP de clientes de la API enumeradas explícitamente aquí, cualquier dirección IP está autorizada.',
     'email_share_item_subject' => '[TeamPass] Un elemento ha sido compartido con usted',
-    'email_share_item_mail' => 'Hola,&lt;br&gt;&lt;br&gt;&lt;u&gt;#tp_user#&lt;/u&gt; ha compartido con usted el elemento &lt;b&gt;#tp_item#&lt;/b&gt;&lt;br&gt;Pulse &lt;a href=\'#tp_link#\'&gt;aquí&lt;/a&gt; para acceder.&lt;br&gt;&lt;br&gt;Saludos.',
+    'email_share_item_mail' => 'Hola,&lt;br&gt;&lt;br&gt;&lt;u&gt;#tp_user#&lt;/u&gt; ha compartido con usted el elemento &lt;b&gt;#tp_item#&lt;/b&gt;&lt;br&gt;Pulse &lt;a href="#tp_link#"&gt;aquí&lt;/a&gt; para acceder.&lt;br&gt;&lt;br&gt;Saludos.',
     'index_maintenance_mode_admin' => 'Modo de mantenimiento activado. En este momento los usuarios no pueden acceder a TeamPass.',
     '2fa_authentication_selector' => 'Select a 2 factor authenticator method',
     'upload_empty_file' => 'Upload empty file',
     'upload_any_extension_file' => 'Upload any extension file',
     'upload_any_extension_file_tip' => 'When enabled, this option will allow users to upload any kind of files.',
diff --git a/includes/language/swedish.php b/includes/language/swedish.php
index 4b6dfea4..35628e1e 100755
--- a/includes/language/swedish.php
+++ b/includes/language/swedish.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      swedish.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -445,11 +445,11 @@ return array(
     'admin_ga_website_name' => 'Name displayed in Google 2-step Verification for Teampass',
     'admin_ga_website_name_tip' => 'This name is used for the identification code account in Google 2-step Verification.',
     'api_whitelist_ips' => 'API IPs Whitelist',
     'api_whitelist_ips_tip' => 'If no API client IP addresses are explicitly listed here, then any IP address is authorized.',
     'email_share_item_subject' => 'A password item was shared with you',
-    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href=\'#tp_link#\'>Click this link</a> to access the item.<br><br><br>Greetings',
+    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href="#tp_link#">Click this link</a> to access the item.<br><br><br>Greetings',
     'index_maintenance_mode_admin' => 'Maintenance mode is enabled. Users cannot sign in.',
     '2fa_authentication_selector' => 'Select a 2 factor authentication method',
     'upload_empty_file' => 'Upload empty file',
     'upload_any_extension_file' => 'Upload any extension file',
     'upload_any_extension_file_tip' => 'When enabled, this option will allow users to upload any kind of files.',
diff --git a/includes/language/turkish.php b/includes/language/turkish.php
index 140e4e57..eb41100e 100755
--- a/includes/language/turkish.php
+++ b/includes/language/turkish.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      turkish.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/ukrainian.php b/includes/language/ukrainian.php
index 88944356..11a7208d 100755
--- a/includes/language/ukrainian.php
+++ b/includes/language/ukrainian.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      ukrainian.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/includes/language/vietnamese.php b/includes/language/vietnamese.php
index bbec2416..0470d9bf 100755
--- a/includes/language/vietnamese.php
+++ b/includes/language/vietnamese.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      vietnamese.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/index.php b/index.php
index ac9d1377..537437f5 100755
--- a/index.php
+++ b/index.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      index.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/install/install.php b/install/install.php
index 45b79406..f1a361fb 100755
--- a/install/install.php
+++ b/install/install.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      install.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -285,11 +285,11 @@ define('MIN_PHP_VERSION', 7.4);
 		
 					<div class="form-group">
 						<label>Absolute path to SaltKey</label>
 						<input type="text" class="form-control" name="sk_path" id="sk_path" class="ui-widget" value=""><span id="res4_check2"></span>
 						<small class="form-text text-muted">
-							The SaltKey is stored in a file called teampass-seckey.txt. For security reasons, this file should be stored in a folder outside the WWW folder of your server (example: /var/teampass/). This key will be used to encrypt data when sharing information with users without any Teampass account. If this field remains empty, this file will be stored in folder <path to Teampass>/includes/.
+							The SaltKey is stored in a file called teampass-seckey.txt and hashed for security purpose. For security reasons, this file should be stored in a folder outside the WWW folder of your server (example: /var/teampass/). This key will be used to encrypt data when sharing information with users without any Teampass account. If this field remains empty, this file will be stored in folder <path to Teampass>/includes/.
 						</small>
 					</div>
 		
 					<div class="form-group">
 						<label>Teampass Administrator password</label>
diff --git a/install/install.queries.php b/install/install.queries.php
index 968d0b72..1635aca9 100755
--- a/install/install.queries.php
+++ b/install/install.queries.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      install.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -1348,11 +1348,12 @@ $SETTINGS = array (';
 
             if ($activity === 'file') {
                 if ($task === 'settings.php') {
                     // first is to create teampass-seckey.txt
                     // 0- check if exists
-                    $filename_seckey = $securePath . '/teampass-seckey.txt';
+                    define('SECUREFILE', generateRandomKey(25));
+                    $filename_seckey = $securePath . '/' . SECUREFILE;
 
                     if (file_exists($filename_seckey)) {
                         if (!copy($filename_seckey, $filename_seckey . '.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) {
                             echo '[{"error" : "File `$filename_seckey` already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]';
                             break;
@@ -1422,10 +1423,11 @@ define("DB_SSL", array(
 ));
 define("DB_CONNECT_OPTIONS", array(
     MYSQLI_OPT_CONNECT_TIMEOUT => 10
 ));
 define("SECUREPATH", "' . $securePath . '");
+define("SECUREFILE", "' . SECUREFILE. '");
 
 if (isset($_SESSION[\'settings\'][\'timezone\']) === true) {
     date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']);
 }
 '
diff --git a/install/migrate_users_to_v3.php b/install/migrate_users_to_v3.php
index fa534e6c..49d85f1c 100755
--- a/install/migrate_users_to_v3.php
+++ b/install/migrate_users_to_v3.php
@@ -6,11 +6,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      migrate_users_to_v3.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/tp.functions.php b/install/tp.functions.php
old mode 100755
new mode 100644
index a8b28f8b..b32de31c
--- a/install/tp.functions.php
+++ b/install/tp.functions.php
@@ -1,7 +1,93 @@
 <?php
 
+// new SECUREFILE - 3.0.0.23
+function handleSecurefileConstant()
+{
+    if (defined('SECUREFILE') === false) {
+        define('SECUREFILE', generateRandomKey(25));
+        
+        // manage the file itself by renaming it
+        if (rename(SECUREPATH.'/teampass-seckey.txt', SECUREPATH.'/'.SECUREFILE) === false) {
+            echo '[{
+                "error" : "File `'.SECUREPATH.'/teampass-seckey.txt` could not be renamed. Please do it by yourself and click on button Launch.",
+                "index" : ""
+            }]';
+            exit;
+        }
+
+        // Ensure DB is read as UTF8
+        if (defined('DB_ENCODING') === false) {
+            define('DB_ENCODING', "utf8");
+        }
+
+        // Now create new file
+        $file_handled = fopen('../includes/config/settings.php', 'w');
+        
+        $settingsTxt = '<?php
+// DATABASE connexion parameters
+define("DB_HOST", "' . DB_HOST . '");
+define("DB_USER", "' . DB_USER . '");
+define("DB_PASSWD", "' . DB_PASSWD . '");
+define("DB_NAME", "' . DB_NAME . '");
+define("DB_PREFIX", "' . DB_PREFIX . '");
+define("DB_PORT", "' . DB_PORT . '");
+define("DB_ENCODING", "' . DB_ENCODING . '");
+define("DB_SSL", array(
+    "key" => "'.DB_SSL['key'].'",
+    "cert" => "'.DB_SSL['cert'].'",
+    "ca_cert" => ""'.DB_SSL['ca_cert'].',
+    "ca_path" => "'.DB_SSL['ca_path'].'",
+    "cipher" => "'.DB_SSL['cipher'].'"
+));
+define("DB_CONNECT_OPTIONS", array(
+    MYSQLI_OPT_CONNECT_TIMEOUT => 10
+));
+define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");
+define("SECUREFILE", "' . SECUREFILE. '");';
+
+        if (defined('IKEY') === true) $settingsTxt .= '
+define("IKEY", "' . IKEY . '");';
+        else $settingsTxt .= '
+define("IKEY", "");';
+        if (defined('SKEY') === true) $settingsTxt .= '
+define("SKEY", "' . SKEY . '");';
+        else $settingsTxt .= '
+define("SKEY", "");';
+        if (defined('HOST') === true) $settingsTxt .= '
+define("HOST", "' . HOST . '");';
+        else $settingsTxt .= '
+define("HOST", "");';
+
+
+        $settingsTxt .= '
+
+if (isset($_SESSION[\'settings\'][\'timezone\']) === true) {
+    date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']);
+}
+';
+
+        $fileCreation = fwrite(
+            $file_handled,
+            utf8_encode($settingsTxt)
+        );
+
+        fclose($file_handled);
+        sleep(3);
+        if ($fileCreation === false) {
+            return [
+                'error' => true,
+                'message' => 'Setting.php file could not be created in /includes/config/ folder. Please check the path and the rights.',
+            ];
+        }
+
+        return [
+            'error' => false,
+            'message' => ''
+        ];
+    }
+}
 
 /**
  * Undocumented function
  *
  * @param string $message   Message
@@ -35,11 +121,12 @@ function defuseCryption($message, $ascii_key, $type)
     include_once '../includes/config/settings.php';
 
     // init
     $err = '';
     if (empty($ascii_key) === true) {
-        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
+        // new check - 3.0.0.23
+        $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
     }
     
     // convert KEY
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
 
diff --git a/install/upgrade.php b/install/upgrade.php
index e785673b..b0796495 100755
--- a/install/upgrade.php
+++ b/install/upgrade.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_ajax.php b/install/upgrade_ajax.php
old mode 100755
new mode 100644
index 13f37c0d..613bf51e
--- a/install/upgrade_ajax.php
+++ b/install/upgrade_ajax.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_ajax.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -173,10 +173,11 @@ define("DB_SSL", array(
 ));
 define("DB_CONNECT_OPTIONS", array(
     MYSQLI_OPT_CONNECT_TIMEOUT => 10
 ));
 define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");';
+define("SECUREFILE", "' . SECUREFILE. '");
 
 		if (defined('IKEY') === true) $settingsTxt .= '
 define("IKEY", "' . IKEY . '");';
 		else $settingsTxt .= '
 define("IKEY", "");';
@@ -219,10 +220,11 @@ if (isset($_SESSION[\'settings\'][\'timezone\']) === true) {
         define("DB_PORT", "' . $port . '");
         define("DB_ENCODING", "' . $encoding . '");
 	}
 }
 
+
 // Test DB connexion
 $pass = defuse_return_decrypted(DB_PASSWD);
 $server = DB_HOST;
 $pre = DB_PREFIX;
 $database = DB_NAME;
@@ -850,21 +852,10 @@ if (isset($post_type)) {
                 ));
             }
 
             // Manage saltkey.txt file
             if (empty($post_sk_path) === false || defined('SECUREPATH') === true) {
-                /*
-                $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/teampass-seckey.txt';
-                if (file_exists($filename)) {
-                    $newfile = str_replace('teampass-seckey.txt', time());
-                    rename($filename, $newfile);
-                    unlink($filename);
-                    echo '$("#step5_saltkeyFile").html("<i class=\"fa-solid fa-circle-check fa-lg text-success ml-2 mr-2\"></i><span class=\"text-info font-italic\">You can remove file '.$newfile.'</span>");';
-                } else {
-                    echo '$("#step5_saltkeyFile").html("<i class=\"fa-solid fa-circle-check fa-lg text-success ml-2 mr-2\"></i><span class=\"text-info font-italic\">Nothing done</span>");';
-                }
-                */
                 array_push(
                     $returnStatus, 
                     array(
                         'id' => 'step5_saltkeyFile', 
                         'html' => '<i class="fa-solid fa-circle-check fa-lg text-success ml-2 mr-2"></i><span class="text-info font-italic">Nothing done</span>',
diff --git a/install/upgrade_run_3.0.0.php b/install/upgrade_run_3.0.0.php
old mode 100755
new mode 100644
index 586e3be7..04f51ea2
--- a/install/upgrade_run_3.0.0.php
+++ b/install/upgrade_run_3.0.0.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -33,10 +33,19 @@ require_once '../includes/config/settings.php';
 require_once '../sources/main.functions.php';
 require_once '../includes/libraries/Tree/NestedTree/NestedTree.php';
 require_once 'tp.functions.php';
 require_once 'libs/aesctr.php';
 require_once '../includes/config/tp.config.php';
+
+// 3.0.0.23
+$ret = handleSecurefileConstant();
+if ($ret['error'] === true) {
+    echo '[{"finish":"1", "msg":"", "error":"'.$ret['message'].'"}]';
+    exit();
+}
+
+// Get the encrypted password
 define('DB_PASSWD_CLEAR', defuse_return_decrypted(DB_PASSWD));
 
 //Build tree
 $tree = new Tree\NestedTree\NestedTree(
     $pre . 'nested_tree',
@@ -74,10 +83,12 @@ if (mysqli_connect(
     mysqli_close($db_link);
     exit();
 }
 
 
+
+
 // Load libraries
 require_once '../includes/libraries/protect/SuperGlobal/SuperGlobal.php';
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
 
 // Set Session
diff --git a/install/upgrade_run_3.0.0_fields.php b/install/upgrade_run_3.0.0_fields.php
index 8440887b..3788c0cb 100755
--- a/install/upgrade_run_3.0.0_fields.php
+++ b/install/upgrade_run_3.0.0_fields.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_fields.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_run_3.0.0_files.php b/install/upgrade_run_3.0.0_files.php
index 3f83d8db..328a2094 100755
--- a/install/upgrade_run_3.0.0_files.php
+++ b/install/upgrade_run_3.0.0_files.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_files.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -147,23 +147,12 @@ while ($file_info = mysqli_fetch_array($rows)) {
     // Check if is file
     if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file']) === true) {
         // Is this file encrypted?
         // Force all files to be encrypted
         if ($file_info['status'] === 'encrypted') {
-            // load PhpEncryption library
-            /*include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Crypto.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Encoding.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'DerivedKeys.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Key.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'KeyOrPassword.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'File.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'RuntimeTests.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'KeyProtectedByPassword.php';
-            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Core.php';*/
-
             // get KEY
-            $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
+            $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 
             // Now decrypt the file
             $err = '';
             try {
                 \Defuse\Crypto\File::decryptFile(
diff --git a/install/upgrade_run_3.0.0_logs.php b/install/upgrade_run_3.0.0_logs.php
index e1a8b760..230b4247 100755
--- a/install/upgrade_run_3.0.0_logs.php
+++ b/install/upgrade_run_3.0.0_logs.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_logs.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_run_3.0.0_passwords.php b/install/upgrade_run_3.0.0_passwords.php
index e56691a9..92bd65c2 100755
--- a/install/upgrade_run_3.0.0_passwords.php
+++ b/install/upgrade_run_3.0.0_passwords.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_passwords.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_run_3.0.0_suggestions.php b/install/upgrade_run_3.0.0_suggestions.php
index e34dd277..f21a989e 100755
--- a/install/upgrade_run_3.0.0_suggestions.php
+++ b/install/upgrade_run_3.0.0_suggestions.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_suggestions.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_run_3.0.0_users.php b/install/upgrade_run_3.0.0_users.php
index d647e7c1..29e06a76 100755
--- a/install/upgrade_run_3.0.0_users.php
+++ b/install/upgrade_run_3.0.0_users.php
@@ -6,11 +6,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_run_3.0.0_users.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/install/upgrade_scripts_manager.php b/install/upgrade_scripts_manager.php
index 3aed077a..b4dd1987 100755
--- a/install/upgrade_scripts_manager.php
+++ b/install/upgrade_scripts_manager.php
@@ -5,11 +5,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upgrade_scripts_manager.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/pages/2fa.js.php b/pages/2fa.js.php
index 493d84ee..36f97273 100755
--- a/pages/2fa.js.php
+++ b/pages/2fa.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      2fa.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/2fa.php b/pages/2fa.php
index a01d5898..fb5d29a7 100755
--- a/pages/2fa.php
+++ b/pages/2fa.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      2fa.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/actions.js.php b/pages/actions.js.php
index f89b127f..04645bbc 100755
--- a/pages/actions.js.php
+++ b/pages/actions.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      actions.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/actions.php b/pages/actions.php
index d5a3320c..2b10ac30 100755
--- a/pages/actions.php
+++ b/pages/actions.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      actions.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/admin.js.php b/pages/admin.js.php
index 6dae8e98..e55a6fda 100755
--- a/pages/admin.js.php
+++ b/pages/admin.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      admin.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/admin.php b/pages/admin.php
index 39d90fcb..75a6756d 100755
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      admin.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/api.js.php b/pages/api.js.php
index a1098fa9..50ca683e 100755
--- a/pages/api.js.php
+++ b/pages/api.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      api.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/api.php b/pages/api.php
index 9e96788a..8efd8edc 100755
--- a/pages/api.php
+++ b/pages/api.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      api.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/backups.js.php b/pages/backups.js.php
index f73efd1c..7f8f71f4 100755
--- a/pages/backups.js.php
+++ b/pages/backups.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      backups.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/backups.php b/pages/backups.php
index 7b215022..d38ac00b 100755
--- a/pages/backups.php
+++ b/pages/backups.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      backups.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/emails.js.php b/pages/emails.js.php
index 1d4a599f..463a5747 100755
--- a/pages/emails.js.php
+++ b/pages/emails.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      emails.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/emails.php b/pages/emails.php
index 25096331..98884865 100755
--- a/pages/emails.php
+++ b/pages/emails.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      emails.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/export.js.php b/pages/export.js.php
index 86765860..b665744c 100755
--- a/pages/export.js.php
+++ b/pages/export.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      export.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/export.php b/pages/export.php
index 60ed3588..ae5dc327 100755
--- a/pages/export.php
+++ b/pages/export.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      export.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/favorites.js.php b/pages/favorites.js.php
index 711a2033..1d33c912 100755
--- a/pages/favorites.js.php
+++ b/pages/favorites.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      favorites.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/favourites.php b/pages/favourites.php
index 014e597c..487fcb51 100755
--- a/pages/favourites.php
+++ b/pages/favourites.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      favourites.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/fields.js.php b/pages/fields.js.php
index a252b542..12e16885 100755
--- a/pages/fields.js.php
+++ b/pages/fields.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      fields.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/fields.php b/pages/fields.php
index 5c32057e..0b8e3ed4 100755
--- a/pages/fields.php
+++ b/pages/fields.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      fields.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/folders.js.php b/pages/folders.js.php
index 43e2586d..f86bb7af 100755
--- a/pages/folders.js.php
+++ b/pages/folders.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      folders.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/folders.php b/pages/folders.php
index d00e9e1c..4ab32164 100755
--- a/pages/folders.php
+++ b/pages/folders.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      folders.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/import.js.php b/pages/import.js.php
index 5f7e2e57..338a2c55 100755
--- a/pages/import.js.php
+++ b/pages/import.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      import.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/import.php b/pages/import.php
index 79783bdd..f8c7b7e8 100755
--- a/pages/import.php
+++ b/pages/import.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      import.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/items.js.php b/pages/items.js.php
index f5550650..d878e21e 100755
--- a/pages/items.js.php
+++ b/pages/items.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      items.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
@@ -4114,26 +4114,47 @@ $var['hidden_asterisk'] = '<i class="fas fa-asterisk mr-2"></i><i class="fas fa-
             prepareFolderDragNDrop();
         }
     }
 
 
+    function checkAccess(itemId, treeId, userId)
+    {
+        var data = {
+            'itemId': parseInt(itemId),
+            'treeId': parseInt(treeId),
+            'userId': parseInt(userId),
+        };
+
+        //Send query
+        $.post(
+            'sources/items.queries.php', {
+                type: 'check_current_access_rights',
+                data: prepareExchangedData(JSON.stringify(data), 'encode', '<?php echo $_SESSION['key']; ?>'),
+                key: '<?php echo $_SESSION['key']; ?>'
+            },
+            function(data) {
+                //decrypt data
+                data = decodeQueryReturn(data, '<?php echo $_SESSION['key']; ?>', 'items.queries.php', 'show_details_item');
+                requestRunning = true;
+                if (debugJavascript === true) {
+                    console.log("DEBUG: checkAccess");
+                    console.log(data);
+                }
+
+
+                return false;
+            }
+        );
+    }
 
 
     /**
      *
      */
     function Details(itemDefinition, actionType, hotlink = false) {
         if (debugJavascript === true) console.info('EXPECTED ACTION on ' + itemDefinition + ' is ' + actionType + ' -- ')
 
-        // Store current view
-        savePreviousView();
-        
-        if (debugJavascript === true) console.log("Request is running: " + requestRunning)
-
-        // Store status query running
-        requestRunning = true;
-
         // Init
         if (hotlink === false) {
             var itemId = parseInt($(itemDefinition).data('item-id')) || '';
             var itemTreeId = parseInt($(itemDefinition).data('item-tree-id')) || '';
             var itemSk = parseInt($(itemDefinition).data('item-sk')) || 0;
@@ -4153,10 +4174,32 @@ $var['hidden_asterisk'] = '<i class="fas fa-asterisk mr-2"></i><i class="fas fa-
             var itemOpenEdit = 0;
             var itemReload = 0;
             var itemRights = parseInt($(itemDefinition).data('item-rights')) || 10;
         }
 
+        // check if user still has access
+        if (checkAccess(itemId, itemTreeId, <?php echo $_SESSION['user_id']; ?>) === false) {
+            toastr.remove();
+            toastr.warning(
+                '<?php echo langHdl('no_item_to_display'); ?>',
+                '', {
+                    timeOut: 5000,
+                    progressBar: true
+                }
+            );
+
+            // Finished
+            return false;
+        }
+
+        // Store current view
+        savePreviousView();
+        
+        if (debugJavascript === true) console.log("Request is running: " + requestRunning)
+
+        // Store status query running
+        requestRunning = true;
         userDidAChange = false;
 
         // Select tab#1
         $('#form-item-nav-pills li:first-child a').tab('show');
 
diff --git a/pages/items.php b/pages/items.php
index 03f6a469..aafb7603 100755
--- a/pages/items.php
+++ b/pages/items.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      items.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/kb.php b/pages/kb.php
index 49ca141d..49b43af6 100755
--- a/pages/kb.php
+++ b/pages/kb.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      kb.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/ldap.js.php b/pages/ldap.js.php
index 3f8f4495..a5b21387 100755
--- a/pages/ldap.js.php
+++ b/pages/ldap.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      ldap.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/ldap.php b/pages/ldap.php
index 8848af5c..64bdf211 100755
--- a/pages/ldap.php
+++ b/pages/ldap.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      ldap.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/offline.js.php b/pages/offline.js.php
index e9b52c8d..555463ab 100755
--- a/pages/offline.js.php
+++ b/pages/offline.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      offline.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/offline.php b/pages/offline.php
index 571cd1aa..3c1da73a 100755
--- a/pages/offline.php
+++ b/pages/offline.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      offline.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/options.js.php b/pages/options.js.php
index 437b80ea..f5f0c9d5 100755
--- a/pages/options.js.php
+++ b/pages/options.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      options.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/options.php b/pages/options.php
index dd8ae759..162c287e 100755
--- a/pages/options.php
+++ b/pages/options.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      options.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/profile.js.php b/pages/profile.js.php
index c65c3baf..a37c3324 100755
--- a/pages/profile.js.php
+++ b/pages/profile.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      profile.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/profile.php b/pages/profile.php
index 13a3f4ea..ecab712d 100755
--- a/pages/profile.php
+++ b/pages/profile.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      profile.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/roles.js.php b/pages/roles.js.php
index d625fc43..ac6e42e3 100755
--- a/pages/roles.js.php
+++ b/pages/roles.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      roles.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/roles.php b/pages/roles.php
index 20413c8b..f4aaaf10 100755
--- a/pages/roles.php
+++ b/pages/roles.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      roles.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/search.js.php b/pages/search.js.php
index 3956c114..d4ca87a8 100755
--- a/pages/search.js.php
+++ b/pages/search.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   * ---
   *
   * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
   *
   * @file      search.js.php
   * ---
   *
   * @author    Nils Laumaillé (nils@teampass.net)
diff --git a/pages/search.php b/pages/search.php
index 637e2e65..01139a6f 100755
--- a/pages/search.php
+++ b/pages/search.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      search.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/special.php b/pages/special.php
index 24f2656e..10a2acb9 100755
--- a/pages/special.php
+++ b/pages/special.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      special.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/statistics.js.php b/pages/statistics.js.php
index bdb2277b..eb7876d5 100755
--- a/pages/statistics.js.php
+++ b/pages/statistics.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      statistics.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/statistics.php b/pages/statistics.php
index a0badbbd..31c00f45 100755
--- a/pages/statistics.php
+++ b/pages/statistics.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      statistics.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/suggestion.php b/pages/suggestion.php
index f0b6cc24..8fd51170 100755
--- a/pages/suggestion.php
+++ b/pages/suggestion.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      suggestion.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/tasks.js.php b/pages/tasks.js.php
index 1c872497..63d1a403 100755
--- a/pages/tasks.js.php
+++ b/pages/tasks.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      tasks.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/tasks.php b/pages/tasks.php
index 373baceb..30899c01 100755
--- a/pages/tasks.php
+++ b/pages/tasks.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      tasks.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/uploads.js.php b/pages/uploads.js.php
index fa933d97..2380c7f5 100755
--- a/pages/uploads.js.php
+++ b/pages/uploads.js.php
@@ -6,11 +6,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      uploads.js.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/pages/uploads.php b/pages/uploads.php
index f509d627..c5922bc3 100755
--- a/pages/uploads.php
+++ b/pages/uploads.php
@@ -6,11 +6,11 @@
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      uploads.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/pages/users.js.php b/pages/users.js.php
index bc33c1f2..e3281f72 100755
--- a/pages/users.js.php
+++ b/pages/users.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      users.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/users.php b/pages/users.php
index ffde7895..8450d5d5 100755
--- a/pages/users.php
+++ b/pages/users.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      users.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.database.js.php b/pages/utilities.database.js.php
index d40f6422..7f170720 100755
--- a/pages/utilities.database.js.php
+++ b/pages/utilities.database.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.database.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.database.php b/pages/utilities.database.php
index 18277532..e6110633 100755
--- a/pages/utilities.database.php
+++ b/pages/utilities.database.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.database.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.deletion.js.php b/pages/utilities.deletion.js.php
index d95b9001..a98986f0 100755
--- a/pages/utilities.deletion.js.php
+++ b/pages/utilities.deletion.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.deletion.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.deletion.php b/pages/utilities.deletion.php
index db1a73ec..2c083f91 100755
--- a/pages/utilities.deletion.php
+++ b/pages/utilities.deletion.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.deletion.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.logs.js.php b/pages/utilities.logs.js.php
index fed8fee1..276de04c 100755
--- a/pages/utilities.logs.js.php
+++ b/pages/utilities.logs.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.logs.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.logs.php b/pages/utilities.logs.php
index 1efc8a13..03a9eb16 100755
--- a/pages/utilities.logs.php
+++ b/pages/utilities.logs.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.logs.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.php b/pages/utilities.php
index 11356c8d..7a404d73 100755
--- a/pages/utilities.php
+++ b/pages/utilities.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.renewal.js.php b/pages/utilities.renewal.js.php
index 057f1c8e..841c43ef 100755
--- a/pages/utilities.renewal.js.php
+++ b/pages/utilities.renewal.js.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.renewal.js.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/pages/utilities.renewal.php b/pages/utilities.renewal.php
index bfdb17d1..a474b32f 100755
--- a/pages/utilities.renewal.php
+++ b/pages/utilities.renewal.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.renewal.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/admin.queries.php b/sources/admin.queries.php
index 4c520c7b..74a70b35 100755
--- a/sources/admin.queries.php
+++ b/sources/admin.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      admin.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -1046,11 +1046,11 @@ switch ($post_type) {
     */
     case 'admin_action_change_salt_key___start':
         // Check KEY
         if ($post_key !== $_SESSION['key']) {
             echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+                $SETTINGS['cpassman_dir'],
                 array(
                     'error' => true,
                     'message' => langHdl('key_is_not_correct'),
                 ),
                 'encode'
@@ -1058,11 +1058,11 @@ switch ($post_type) {
             break;
         }
         // Is admin?
         if ($_SESSION['is_admin'] === true) {
             echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+                $SETTINGS['cpassman_dir'],
                 array(
                     'error' => true,
                     'message' => langHdl('error_not_allowed_to'),
                 ),
                 'encode'
@@ -1072,26 +1072,26 @@ switch ($post_type) {
 
         $error = '';
         require_once 'main.functions.php';
 
         // store old sk
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 
         // generate new saltkey
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
         copy(
-            SECUREPATH . '/teampass-seckey.txt',
+            SECUREPATH.'/'.SECUREFILE,
             $old_sk_filename
         );
         $new_key = defuse_generate_key();
         file_put_contents(
-            SECUREPATH . '/teampass-seckey.txt',
+            SECUREPATH.'/'.SECUREFILE,
             $new_key
         );
 
         // store new sk
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 
         //put tool in maintenance.
         DB::update(
             prefixTable('misc'),
             array(
@@ -1590,11 +1590,11 @@ switch ($post_type) {
             'admin'
         );
 
         // Send back
         echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+            $SETTINGS['cpassman_dir'],
             array(
                 'error' => false,
                 'message' => '',
                 'nextAction' => 'done',
             ),
@@ -1607,11 +1607,11 @@ switch ($post_type) {
     */
     case 'admin_action_change_salt_key___restore_backup':
         // Check KEY
         if ($post_key !== $_SESSION['key']) {
             echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+                $SETTINGS['cpassman_dir'],
                 array(
                     'error' => true,
                     'message' => langHdl('key_is_not_correct'),
                 ),
                 'encode'
@@ -1619,11 +1619,11 @@ switch ($post_type) {
             break;
         }
         // Is admin?
         if ($_SESSION['is_admin'] === true) {
             echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+                $SETTINGS['cpassman_dir'],
                 array(
                     'error' => true,
                     'message' => langHdl('error_not_allowed_to'),
                 ),
                 'encode'
@@ -1658,23 +1658,23 @@ switch ($post_type) {
             }
         }
 
         // restore saltkey file
         if (file_exists($previous_saltkey_filename)) {
-            unlink(SECUREPATH . '/teampass-seckey.txt');
+            unlink(SECUREPATH.'/'.SECUREFILE);
             rename(
                 $previous_saltkey_filename,
-                SECUREPATH . '/teampass-seckey.txt'
+                SECUREPATH.'/'.SECUREFILE
             );
         }
 
         // drop table
         DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
 
         // Send back
         echo prepareExchangedData(
-    $SETTINGS['cpassman_dir'],
+            $SETTINGS['cpassman_dir'],
             array(
                 'error' => false,
                 'message' => '',
             ),
             'encode'
diff --git a/sources/aes.functions.php b/sources/aes.functions.php
index f97665e0..0bdd722a 100755
--- a/sources/aes.functions.php
+++ b/sources/aes.functions.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      aes.functions.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/background.php b/sources/background.php
index 7114c619..bf8e729a 100755
--- a/sources/background.php
+++ b/sources/background.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      users.background.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/backups.queries.php b/sources/backups.queries.php
index c35ffc2c..ccf79ec6 100755
--- a/sources/backups.queries.php
+++ b/sources/backups.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      backups.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/checks.php b/sources/checks.php
index 2977b131..a46c7f13 100755
--- a/sources/checks.php
+++ b/sources/checks.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      checks.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/core.php b/sources/core.php
index f2efb7e4..9fcfa051 100755
--- a/sources/core.php
+++ b/sources/core.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      core.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/downloadFile.php b/sources/downloadFile.php
index 8688cf8c..13b0ab82 100755
--- a/sources/downloadFile.php
+++ b/sources/downloadFile.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      downloadFile.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/expired.datatables.php b/sources/expired.datatables.php
index ac918b81..d9239b01 100755
--- a/sources/expired.datatables.php
+++ b/sources/expired.datatables.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      expired.datatables.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/export.queries.php b/sources/export.queries.php
index f419a57a..16a768a4 100755
--- a/sources/export.queries.php
+++ b/sources/export.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      export.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -249,11 +249,11 @@ if (null !== $post_type) {
                                     'perso' => $record['perso'] === '0' ? 'False' : 'True',
                                     'url' => $record['url'] !== 'none' && is_null($record['url']) === false && empty($record['url']) === false ? htmlspecialchars_decode($record['url']) : '',
                                     'email' => $record['email'] !== 'none' ? (is_null($record['email']) === false ? cleanStringForExport($record['email']) : '') : '',
                                     'kbs' => implode(' | ', $arr_kbs),
                                     'tags' => implode(' ', $arr_tags),
-                                    'folder' => implode(' > ', $arr_trees),
+                                    'folder' => implode('/', $arr_trees),
                                 );
                                 ++$i;
 
                                 // log
                                 logItems(
diff --git a/sources/favourites.queries.php b/sources/favourites.queries.php
index 5bab1dde..681b15ac 100755
--- a/sources/favourites.queries.php
+++ b/sources/favourites.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      favourites.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/fields.queries.php b/sources/fields.queries.php
index 35c1dfb9..3ee1151e 100755
--- a/sources/fields.queries.php
+++ b/sources/fields.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      fields.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/find.queries.php b/sources/find.queries.php
index 7c0b9357..5db827f3 100755
--- a/sources/find.queries.php
+++ b/sources/find.queries.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      find.queries.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/folders.datatable.php b/sources/folders.datatable.php
index ad839e86..cb4bed68 100755
--- a/sources/folders.datatable.php
+++ b/sources/folders.datatable.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      folders.datatable.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/folders.queries.php b/sources/folders.queries.php
index 66da9c4d..c7b9e588 100755
--- a/sources/folders.queries.php
+++ b/sources/folders.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      folders.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/identify.php b/sources/identify.php
index c0d4bed3..b18b070b 100755
--- a/sources/identify.php
+++ b/sources/identify.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      identify.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/import.queries.php b/sources/import.queries.php
index 9ef08a40..25eac4ae 100755
--- a/sources/import.queries.php
+++ b/sources/import.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      import.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/items.logs.php b/sources/items.logs.php
index 46cdacc7..7cd4a590 100755
--- a/sources/items.logs.php
+++ b/sources/items.logs.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      items.logs.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/items.queries.php b/sources/items.queries.php
index 1100ac45..91221f12 100755
--- a/sources/items.queries.php
+++ b/sources/items.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      items.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -6003,10 +6003,11 @@ if (is_null($inputData['type']) === false) {
                     'encode'
                 );
                 break;
             }
             $arr_data = [];
+            $arr_folders = [];
 
             // decrypt and retreive data in JSON format
             $dataReceived = prepareExchangedData(
                 $SETTINGS['cpassman_dir'],
                 $inputData['data'],
@@ -6123,10 +6124,11 @@ if (is_null($inputData['type']) === false) {
                         $arr_data['folders'][$inc]['level'] = (int) $folder->nlevel;
                         $arr_data['folders'][$inc]['title'] = ((int) $folder->title === (int) $_SESSION['user_id'] && (int) $folder->nlevel === 1) ? htmlspecialchars_decode($_SESSION['login']) : htmlspecialchars_decode($folder->title, ENT_QUOTES);
                         $arr_data['folders'][$inc]['disabled'] = $disabled;
                         $arr_data['folders'][$inc]['parent_id'] = (int) $folder->parent_id;
                         $arr_data['folders'][$inc]['perso'] = (int) $folder->personal_folder;
+                        //array_push($arr_folders, (int) $folder->id);
 
                         // Is this folder an active folders? (where user can do something)
                         $is_visible_active = 0;
                         if (
                             isset($_SESSION['read_only_folders']) === true
@@ -6138,19 +6140,29 @@ if (is_null($inputData['type']) === false) {
 
                         ++$inc;
                     }
                 }
             }
+            /*
             if (isset($arr_data['folders']) === true) {
                 // save to cache_tree
                 cacheTreeUserHandler(
                     (int) $_SESSION['user_id'],
                     json_encode($arr_data['folders']),
                     $SETTINGS,
                     'visible_folders',
                 );
+
+                // save to cache_tree
+                cacheTreeUserHandler(
+                    (int) $_SESSION['user_id'],
+                    json_encode($arr_folders),
+                    $SETTINGS,
+                    'folders',
+                );
             }
+            */
 
             // send data
             echo (string) prepareExchangedData(
                 $SETTINGS['cpassman_dir'],
                 [
@@ -6786,10 +6798,65 @@ if (is_null($inputData['type']) === false) {
                 $SETTINGS['cpassman_dir'],
                 $data,
                 'encode'
             );
 
+            break;
+
+        /*
+        * CASE
+        * check_current_access_rights
+        */
+        case 'check_current_access_rights':
+            // Check KEY
+            if ($inputData['key'] !== $_SESSION['key']) {
+                echo (string) prepareExchangedData(
+                    $SETTINGS['cpassman_dir'],
+                    array(
+                        'error' => 'key_not_conform',
+                        'message' => langHdl('key_is_not_correct'),
+                    ),
+                    'encode'
+                );
+                break;
+            }
+            // decrypt and retrieve data in JSON format
+            $dataReceived = prepareExchangedData(
+                $SETTINGS['cpassman_dir'],
+                $inputData['data'],
+                'decode'
+            );
+
+            // prepare variables
+            $inputData['userId'] = (int) filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
+            $inputData['itemId'] = (int) filter_var($dataReceived['itemId'], FILTER_SANITIZE_NUMBER_INT);
+            $inputData['treeId'] = (int) filter_var($dataReceived['treeId'], FILTER_SANITIZE_NUMBER_INT);
+
+            $data = DB::queryFirstRow(
+                'SELECT visible_folders
+                FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
+                $inputData['userId']
+            );
+            // Check if tree ID is in visible folders.
+            if (null !== $data['visible_folders']) {
+                $arr = json_decode($data['visible_folders'], true);
+                $ids = array_column($arr, 'id');
+            }
+
+
+            $data = array(
+                'error' => false,
+                'access' => isset($inputData['treeId']) === true && in_array($inputData['treeId'], $ids) === true ? true : false,
+            );
+
+            // send data
+            echo (string) prepareExchangedData(
+                $SETTINGS['cpassman_dir'],
+                $data,
+                'encode'
+            );
+
             break;
     }
 }
 // Build the QUERY in case of GET
 if (isset($inputData['getType'])) {
diff --git a/sources/ldap.queries.php b/sources/ldap.queries.php
index 5e0175b4..50bcde1b 100755
--- a/sources/ldap.queries.php
+++ b/sources/ldap.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      ldap.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/logs.datatables.php b/sources/logs.datatables.php
index 21909186..83fff736 100755
--- a/sources/logs.datatables.php
+++ b/sources/logs.datatables.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      logs.datatables.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/main.functions.php b/sources/main.functions.php
index 0b06d53a..a16e07ea 100755
--- a/sources/main.functions.php
+++ b/sources/main.functions.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      main.functions.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
@@ -123,11 +123,11 @@ function bCrypt(
  *
  * @return array
  */
 function cryption(string $message, string $ascii_key, string $type, ?array $SETTINGS = []): array
 {
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/'.SECUREFILE) : $ascii_key;
     $err = false;
     
     $path = __DIR__.'/../includes/libraries/Encryption/Encryption/';
 
     include_once $path . 'Exception/CryptoException.php';
@@ -635,11 +635,11 @@ function identUser(
     );
     $inc = 0;
     foreach ($rows as $record) {
         //if (isset($record['id_tree'])) {
             $foldersLimited[$record['id_tree']][$inc] = $record['item_id'];
-            array_push($foldersLimitedFull, $record['item_id']);
+            array_push($foldersLimitedFull, $record['id_tree']);
             ++$inc;
         //}
     }
 
     // Get list of Personal Folders
@@ -649,11 +649,11 @@ function identUser(
         $globalsUserId,
         $personalFolders,
         $noAccessPersonalFolders,
         $foldersLimitedFull,
         $allowedFoldersByRoles,
-        $restrictedFoldersForItems,
+        array_keys($restrictedFoldersForItems),
         $readOnlyFolders,
         $noAccessFolders,
         isset($SETTINGS['enable_pf_feature']) === true ? $SETTINGS['enable_pf_feature'] : 0,
         $tree
     );
@@ -1291,11 +1291,11 @@ function prepareSendingEmail(
                 'arguments' => json_encode([
                     'subject' => $subject,
                     'receivers' => $email,
                     'body' => $body,
                     'receiver_name' => $receiverName,
-                ]),
+                ], JSON_HEX_QUOT | JSON_HEX_TAG),
                 'updated_at' => '',
                 'finished_at' => '',
                 'output' => '',
             )
         );
@@ -1431,11 +1431,11 @@ function buildEmail(
     $mail->FromName = $SETTINGS['email_from_name'];
     // Prepare for each person
     foreach (array_filter(explode(',', $email)) as $dest) {
         $mail->addAddress($dest);
     }
-
+    
     // Prepare HTML
     $text_html = emailBody($textMail);
     $mail->WordWrap = 80;
     // set word wrap
     $mail->isHtml(true);
@@ -2299,11 +2299,11 @@ function prepareFileWithDefuse(
     // Sanitize
     $source_file = $antiXss->xss_clean($source_file);
     $target_file = $antiXss->xss_clean($target_file);
     if (empty($password) === true || is_null($password) === true) {
         // get KEY to define password
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
+        $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
     }
 
     $err = '';
     if ($type === 'decrypt') {
diff --git a/sources/main.queries.php b/sources/main.queries.php
index 89bb6acb..a26026e3 100755
--- a/sources/main.queries.php
+++ b/sources/main.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      main.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/roles.queries.php b/sources/roles.queries.php
index 004af882..e5c702f1 100755
--- a/sources/roles.queries.php
+++ b/sources/roles.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      roles.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -249,10 +249,44 @@ if (null !== $post_type) {
                         );
                     }
                 }
             }
 
+            /*
+            // update folders rights for users in cache_tree
+            // Requested for real-time changes
+            $rows = DB::query(
+                'SELECT increment_id, folders
+                FROM ' . prefixTable('cache_tree'),
+            );
+
+            foreach($rows as $row) {
+                if ($row['folders'] === '' || $post_selectedFolders === null) {
+                    continue;
+                }
+                // get visible folders
+                $arr = json_decode($row['folders'], true);
+                
+                foreach($arr as $folder) {
+                    if (in_array($folder, $post_selectedFolders) === true) {
+                        unset($arr[$folder]);
+                    }
+                }
+                print_r($arr);
+
+                // update
+                /*DB::update(
+                    prefixTable('cache_tree'),
+                    array(
+                        'folders' => json_encode($arr),
+                    ),
+                    'increment_id = %i',
+                    $row['increment_id']
+                );*/
+            }
+            */
+
             echo prepareExchangedData(
                 $SETTINGS['cpassman_dir'],
                 array(
                     'error' => false,
                     'message' => '',
diff --git a/sources/scheduler.php b/sources/scheduler.php
index 81154738..ac74ddcb 100755
--- a/sources/scheduler.php
+++ b/sources/scheduler.php
@@ -6,11 +6,11 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      scheduler.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/tree.php b/sources/tree.php
index 263712ad..1361efbc 100755
--- a/sources/tree.php
+++ b/sources/tree.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      tree.php
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
@@ -249,12 +249,21 @@ function showFolderToUser(
     array $session_groupes_visibles,
     array $listFoldersLimitedKeys,
     array $listRestrictedFoldersForItemsKeys
 ): bool
 {
-    $big_array = array_diff(array_unique(array_merge($session_groupes_visibles, $listFoldersLimitedKeys, $listRestrictedFoldersForItemsKeys), SORT_NUMERIC), $session_forbiden_pfs);
-    //print_r($session_groupes_visibles);
+    $big_array = array_diff(
+        array_unique(
+            array_merge(
+                $session_groupes_visibles, 
+                $listFoldersLimitedKeys, 
+                $listRestrictedFoldersForItemsKeys
+            ), 
+            SORT_NUMERIC
+        ), 
+        $session_forbiden_pfs
+    );
     if ($nodeId === 0 || in_array($nodeId, $big_array) === true) {
         return true;
     }
     return false;
 }
diff --git a/sources/upload.attachments.php b/sources/upload.attachments.php
index dc79d525..ae255ba4 100755
--- a/sources/upload.attachments.php
+++ b/sources/upload.attachments.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upload.attachments.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/upload.files.php b/sources/upload.files.php
index 21bde8be..e1e84d2c 100755
--- a/sources/upload.files.php
+++ b/sources/upload.files.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      upload.files.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/user.logs.datatables.php b/sources/user.logs.datatables.php
index 261450c7..c0ef94d7 100755
--- a/sources/user.logs.datatables.php
+++ b/sources/user.logs.datatables.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      user.logs.datatables.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/users.datatable.php b/sources/users.datatable.php
index 2583a306..b9536fc9 100755
--- a/sources/users.datatable.php
+++ b/sources/users.datatable.php
@@ -9,11 +9,11 @@ declare(strict_types=1);
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * ---
  *
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      users.datatable.php
  * ---
  *
  * @author    Nils Laumaillé (nils@teampass.net)
  *
diff --git a/sources/users.queries.php b/sources/users.queries.php
index c1a6620f..3e41cdba 100755
--- a/sources/users.queries.php
+++ b/sources/users.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      users.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/utilities.queries.php b/sources/utilities.queries.php
index 0c15d2ee..fb512f9d 100755
--- a/sources/utilities.queries.php
+++ b/sources/utilities.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utilities.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0
diff --git a/sources/utils.queries.php b/sources/utils.queries.php
index d0163c7c..3128049d 100755
--- a/sources/utils.queries.php
+++ b/sources/utils.queries.php
@@ -8,11 +8,11 @@ declare(strict_types=1);
  * This library 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.
  * ---
  * @project   Teampass
- * @version   3.0.0.22
+ * @version   3.0.0.23
  * @file      utils.queries.php
  * ---
  * @author    Nils Laumaillé (nils@teampass.net)
  * @copyright 2009-2023 Teampass.net
  * @license   https://spdx.org/licenses/GPL-3.0-only.html#licenseText GPL-3.0

Vulnerable code:                     $path .= '>' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
 * @version   3.0.0.22
define('TP_VERSION_FULL', TP_VERSION.'.22');
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href=\'#tp_link#\'>Click this link</a> to access the item.<br><br><br>Greetings',
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    'username' => 'Username',
    'settings_ldap_password_tip' => 'The password of the user specified above.',
    'undefined' => 'Undefined',
    'error_cannot_open_file' => 'File cannot be opened',
    'start' => 'Start',
    'current_password' => 'Current password',
    'password_is_not_correct' => 'This password is not correct',
    'personal_items' => 'Personal items',
    'please_select_a_folder' => 'Please select a folder',
    'in_progress' => 'In progress',
    'all_fields_mandatory' => 'All fields are mandatory',
    'filename' => 'Filename',
    'exported_to_file' => 'Exported to file',
    'operation_progress' => 'Operation is in progress',
    'exporting_items' => 'Exporting items',
    'select_folders_to_export' => 'Select folders to export',
    'export_format_type' => 'Select the export format type',
    'export_items' => 'Export items',
    'loading_item' => 'Loading item',
    'admin_action_check_pf' => 'Criar pastas pessoas para todos os utilizadores que não têm',
    'max_last_items' => 'Maximo de últimos itens visto por um usuários (Padrão é 10)',
    'number_of_used_pw' => 'Número de novas senhas que o usuário precisa ingressar antes de usar uma senha antiga',
    'pw_life_duration' => 'Vida útil da senha de um usuário para expirar (em dia, 0 para desativar)',
    'settings_log_connections' => 'Guarda todos os inícios de sessão',
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    'email_share_item_mail' => 'Hola,&lt;br&gt;&lt;br&gt;&lt;u&gt;#tp_user#&lt;/u&gt; ha compartido con usted el elemento &lt;b&gt;#tp_item#&lt;/b&gt;&lt;br&gt;Pulse &lt;a href=\'#tp_link#\'&gt;aquí&lt;/a&gt; para acceder.&lt;br&gt;&lt;br&gt;Saludos.',
 * @version   3.0.0.22
    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href=\'#tp_link#\'>Click this link</a> to access the item.<br><br><br>Greetings',
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
							The SaltKey is stored in a file called teampass-seckey.txt. For security reasons, this file should be stored in a folder outside the WWW folder of your server (example: /var/teampass/). This key will be used to encrypt data when sharing information with users without any Teampass account. If this field remains empty, this file will be stored in folder <path to Teampass>/includes/.
 * @version   3.0.0.22
                    $filename_seckey = $securePath . '/teampass-seckey.txt';
 * @version   3.0.0.22
        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
 * @version   3.0.0.22
 * @version   3.0.0.22
                /*
                $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/teampass-seckey.txt';
                if (file_exists($filename)) {
                    $newfile = str_replace('teampass-seckey.txt', time());
                    rename($filename, $newfile);
                    unlink($filename);
                    echo '$("#step5_saltkeyFile").html("<i class=\"fa-solid fa-circle-check fa-lg text-success ml-2 mr-2\"></i><span class=\"text-info font-italic\">You can remove file '.$newfile.'</span>");';
                } else {
                    echo '$("#step5_saltkeyFile").html("<i class=\"fa-solid fa-circle-check fa-lg text-success ml-2 mr-2\"></i><span class=\"text-info font-italic\">Nothing done</span>");';
                }
                */
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
            // load PhpEncryption library
            /*include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Crypto.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Encoding.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'DerivedKeys.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Key.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'KeyOrPassword.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'File.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'RuntimeTests.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'KeyProtectedByPassword.php';
            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'.'Core.php';*/

            $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
        // Store current view
        savePreviousView();
        
        if (debugJavascript === true) console.log("Request is running: " + requestRunning)

        // Store status query running
        requestRunning = true;

 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    $SETTINGS['cpassman_dir'],
    $SETTINGS['cpassman_dir'],
        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
            SECUREPATH . '/teampass-seckey.txt',
            SECUREPATH . '/teampass-seckey.txt',
        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
    $SETTINGS['cpassman_dir'],
    $SETTINGS['cpassman_dir'],
    $SETTINGS['cpassman_dir'],
            unlink(SECUREPATH . '/teampass-seckey.txt');
                SECUREPATH . '/teampass-seckey.txt'
    $SETTINGS['cpassman_dir'],
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
                                    'folder' => implode(' > ', $arr_trees),
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
            array_push($foldersLimitedFull, $record['item_id']);
        $restrictedFoldersForItems,
                ]),

        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
    $big_array = array_diff(array_unique(array_merge($session_groupes_visibles, $listFoldersLimitedKeys, $listRestrictedFoldersForItemsKeys), SORT_NUMERIC), $session_forbiden_pfs);
    //print_r($session_groupes_visibles);
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
 * @version   3.0.0.22
Fixed code:                     $path .= '/' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
 * @version   3.0.0.23
define('TP_VERSION_FULL', TP_VERSION.'.23');
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href="#tp_link#">Click this link</a> to access the item.<br><br><br>Greetings',
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
    'username' => 'Utilizador',
    'settings_ldap_password_tip' => 'A palavra-passe do utilizador especificado acima.',
    'undefined' => 'Indefinido',
    'error_cannot_open_file' => 'O ficheiro não pode ser aberto',
    'start' => 'Iniciar',
    'current_password' => 'Palavra-passe atual',
    'password_is_not_correct' => 'Esta palavra-passe não é a correta',
    'personal_items' => 'Itens pessoais',
    'please_select_a_folder' => 'Por favor seleccione uma pasta',
    'in_progress' => 'Em progresso',
    'all_fields_mandatory' => 'Todos os campos são obrigatórios',
    'filename' => 'Nome do ficheiro',
    'exported_to_file' => 'Exportado para ficheiro',
    'operation_progress' => 'A operação está em progresso',
    'exporting_items' => 'A exportar itens',
    'select_folders_to_export' => 'Seleccione pastas para exportar',
    'export_format_type' => 'Seleccione o formato de exportação',
    'export_items' => 'Exportar itens',
    'loading_item' => 'A carregar item',
    'admin_action_check_pf' => 'Criar pastas pessoas para todos os utilizadores que não as têm',
    'max_last_items' => 'Tamanho da lista dos últimos itens vistos (padrão é 10)',
    'number_of_used_pw' => 'Número de palavras-passe antigas guardadas para evitar reutilização (0 para desativar)',
    'pw_life_duration' => 'Palavras-passe de sessão expiram ao fim de xx dias (0 para desativar)',
    'settings_log_connections' => 'Guarda registo de todos os inícios de sessão',
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
    'email_share_item_mail' => 'Hola,&lt;br&gt;&lt;br&gt;&lt;u&gt;#tp_user#&lt;/u&gt; ha compartido con usted el elemento &lt;b&gt;#tp_item#&lt;/b&gt;&lt;br&gt;Pulse &lt;a href="#tp_link#"&gt;aquí&lt;/a&gt; para acceder.&lt;br&gt;&lt;br&gt;Saludos.',
 * @version   3.0.0.23
    'email_share_item_mail' => 'Hello,<br><br>This is a generated email from Teampass passwords manager.<br><br>#tp_user# has shared with you the password item #tp_item#.<br><br><a href="#tp_link#">Click this link</a> to access the item.<br><br><br>Greetings',
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
							The SaltKey is stored in a file called teampass-seckey.txt and hashed for security purpose. For security reasons, this file should be stored in a folder outside the WWW folder of your server (example: /var/teampass/). This key will be used to encrypt data when sharing information with users without any Teampass account. If this field remains empty, this file will be stored in folder <path to Teampass>/includes/.
 * @version   3.0.0.23
                    define('SECUREFILE', generateRandomKey(25));
                    $filename_seckey = $securePath . '/' . SECUREFILE;
define("SECUREFILE", "' . SECUREFILE. '");
 * @version   3.0.0.23
// new SECUREFILE - 3.0.0.23
function handleSecurefileConstant()
{
    if (defined('SECUREFILE') === false) {
        define('SECUREFILE', generateRandomKey(25));
        
        // manage the file itself by renaming it
        if (rename(SECUREPATH.'/teampass-seckey.txt', SECUREPATH.'/'.SECUREFILE) === false) {
            echo '[{
                "error" : "File `'.SECUREPATH.'/teampass-seckey.txt` could not be renamed. Please do it by yourself and click on button Launch.",
                "index" : ""
            }]';
            exit;
        }

        // Ensure DB is read as UTF8
        if (defined('DB_ENCODING') === false) {
            define('DB_ENCODING', "utf8");
        }

        // Now create new file
        $file_handled = fopen('../includes/config/settings.php', 'w');
        
        $settingsTxt = '<?php
// DATABASE connexion parameters
define("DB_HOST", "' . DB_HOST . '");
define("DB_USER", "' . DB_USER . '");
define("DB_PASSWD", "' . DB_PASSWD . '");
define("DB_NAME", "' . DB_NAME . '");
define("DB_PREFIX", "' . DB_PREFIX . '");
define("DB_PORT", "' . DB_PORT . '");
define("DB_ENCODING", "' . DB_ENCODING . '");
define("DB_SSL", array(
    "key" => "'.DB_SSL['key'].'",
    "cert" => "'.DB_SSL['cert'].'",
    "ca_cert" => ""'.DB_SSL['ca_cert'].',
    "ca_path" => "'.DB_SSL['ca_path'].'",
    "cipher" => "'.DB_SSL['cipher'].'"
));
define("DB_CONNECT_OPTIONS", array(
    MYSQLI_OPT_CONNECT_TIMEOUT => 10
));
define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");
define("SECUREFILE", "' . SECUREFILE. '");';

        if (defined('IKEY') === true) $settingsTxt .= '
define("IKEY", "' . IKEY . '");';
        else $settingsTxt .= '
define("IKEY", "");';
        if (defined('SKEY') === true) $settingsTxt .= '
define("SKEY", "' . SKEY . '");';
        else $settingsTxt .= '
define("SKEY", "");';
        if (defined('HOST') === true) $settingsTxt .= '
define("HOST", "' . HOST . '");';
        else $settingsTxt .= '
define("HOST", "");';


        $settingsTxt .= '

if (isset($_SESSION[\'settings\'][\'timezone\']) === true) {
    date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']);
}
';

        $fileCreation = fwrite(
            $file_handled,
            utf8_encode($settingsTxt)
        );

        fclose($file_handled);
        sleep(3);
        if ($fileCreation === false) {
            return [
                'error' => true,
                'message' => 'Setting.php file could not be created in /includes/config/ folder. Please check the path and the rights.',
            ];
        }

        return [
            'error' => false,
            'message' => ''
        ];
    }
}
        // new check - 3.0.0.23
        $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 * @version   3.0.0.23
 * @version   3.0.0.23
define("SECUREFILE", "' . SECUREFILE. '");

 * @version   3.0.0.23

// 3.0.0.23
$ret = handleSecurefileConstant();
if ($ret['error'] === true) {
    echo '[{"finish":"1", "msg":"", "error":"'.$ret['message'].'"}]';
    exit();
}

// Get the encrypted password


 * @version   3.0.0.23
 * @version   3.0.0.23
            $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
    function checkAccess(itemId, treeId, userId)
    {
        var data = {
            'itemId': parseInt(itemId),
            'treeId': parseInt(treeId),
            'userId': parseInt(userId),
        };

        //Send query
        $.post(
            'sources/items.queries.php', {
                type: 'check_current_access_rights',
                data: prepareExchangedData(JSON.stringify(data), 'encode', '<?php echo $_SESSION['key']; ?>'),
                key: '<?php echo $_SESSION['key']; ?>'
            },
            function(data) {
                //decrypt data
                data = decodeQueryReturn(data, '<?php echo $_SESSION['key']; ?>', 'items.queries.php', 'show_details_item');
                requestRunning = true;
                if (debugJavascript === true) {
                    console.log("DEBUG: checkAccess");
                    console.log(data);
                }


                return false;
            }
        );
    }
        // check if user still has access
        if (checkAccess(itemId, itemTreeId, <?php echo $_SESSION['user_id']; ?>) === false) {
            toastr.remove();
            toastr.warning(
                '<?php echo langHdl('no_item_to_display'); ?>',
                '', {
                    timeOut: 5000,
                    progressBar: true
                }
            );

            // Finished
            return false;
        }

        // Store current view
        savePreviousView();
        
        if (debugJavascript === true) console.log("Request is running: " + requestRunning)

        // Store status query running
        requestRunning = true;
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
                $SETTINGS['cpassman_dir'],
                $SETTINGS['cpassman_dir'],
        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
            SECUREPATH.'/'.SECUREFILE,
            SECUREPATH.'/'.SECUREFILE,
        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/'.SECUREFILE);
            $SETTINGS['cpassman_dir'],
                $SETTINGS['cpassman_dir'],
                $SETTINGS['cpassman_dir'],
            unlink(SECUREPATH.'/'.SECUREFILE);
                SECUREPATH.'/'.SECUREFILE
            $SETTINGS['cpassman_dir'],
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
                                    'folder' => implode('/', $arr_trees),
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
            $arr_folders = [];
                        //array_push($arr_folders, (int) $folder->id);
            /*

                // save to cache_tree
                cacheTreeUserHandler(
                    (int) $_SESSION['user_id'],
                    json_encode($arr_folders),
                    $SETTINGS,
                    'folders',
                );
            */
            break;

        /*
        * CASE
        * check_current_access_rights
        */
        case 'check_current_access_rights':
            // Check KEY
            if ($inputData['key'] !== $_SESSION['key']) {
                echo (string) prepareExchangedData(
                    $SETTINGS['cpassman_dir'],
                    array(
                        'error' => 'key_not_conform',
                        'message' => langHdl('key_is_not_correct'),
                    ),
                    'encode'
                );
                break;
            }
            // decrypt and retrieve data in JSON format
            $dataReceived = prepareExchangedData(
                $SETTINGS['cpassman_dir'],
                $inputData['data'],
                'decode'
            );

            // prepare variables
            $inputData['userId'] = (int) filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
            $inputData['itemId'] = (int) filter_var($dataReceived['itemId'], FILTER_SANITIZE_NUMBER_INT);
            $inputData['treeId'] = (int) filter_var($dataReceived['treeId'], FILTER_SANITIZE_NUMBER_INT);

            $data = DB::queryFirstRow(
                'SELECT visible_folders
                FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
                $inputData['userId']
            );
            // Check if tree ID is in visible folders.
            if (null !== $data['visible_folders']) {
                $arr = json_decode($data['visible_folders'], true);
                $ids = array_column($arr, 'id');
            }


            $data = array(
                'error' => false,
                'access' => isset($inputData['treeId']) === true && in_array($inputData['treeId'], $ids) === true ? true : false,
            );

            // send data
            echo (string) prepareExchangedData(
                $SETTINGS['cpassman_dir'],
                $data,
                'encode'
            );

 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/'.SECUREFILE) : $ascii_key;
            array_push($foldersLimitedFull, $record['id_tree']);
        array_keys($restrictedFoldersForItems),
                ], JSON_HEX_QUOT | JSON_HEX_TAG),
    
        $ascii_key = file_get_contents(SECUREPATH.'/'.SECUREFILE);
 * @version   3.0.0.23
 * @version   3.0.0.23
            /*
            // update folders rights for users in cache_tree
            // Requested for real-time changes
            $rows = DB::query(
                'SELECT increment_id, folders
                FROM ' . prefixTable('cache_tree'),
            );

            foreach($rows as $row) {
                if ($row['folders'] === '' || $post_selectedFolders === null) {
                    continue;
                }
                // get visible folders
                $arr = json_decode($row['folders'], true);
                
                foreach($arr as $folder) {
                    if (in_array($folder, $post_selectedFolders) === true) {
                        unset($arr[$folder]);
                    }
                }
                print_r($arr);

                // update
                /*DB::update(
                    prefixTable('cache_tree'),
                    array(
                        'folders' => json_encode($arr),
                    ),
                    'increment_id = %i',
                    $row['increment_id']
                );*/
            }
            */

 * @version   3.0.0.23
 * @version   3.0.0.23
    $big_array = array_diff(
        array_unique(
            array_merge(
                $session_groupes_visibles, 
                $listFoldersLimitedKeys, 
                $listRestrictedFoldersForItemsKeys
            ), 
            SORT_NUMERIC
        ), 
        $session_forbiden_pfs
    );
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23
 * @version   3.0.0.23