From 7f8c79dec569c12a81ce730bc3cc7725c4646819 Mon Sep 17 00:00:00 2001 From: nilsteampassnet Date: Sun, 6 Mar 2022 09:38:59 +0100 Subject: [PATCH] 3.0.0.13 Several fixes after tests --- install/install.queries.php | 4 ++-- install/upgrade_run_3.0.0.php | 18 ++++++++++++++---- pages/items.js.php | 7 ++++++- sources/import.queries.php | 4 ++-- sources/items.queries.php | 2 +- sources/users.queries.php | 2 ++ 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/install/install.queries.php b/install/install.queries.php index 39b3bb38a..7f7cae0e2 100755 --- a/install/install.queries.php +++ b/install/install.queries.php @@ -730,8 +730,8 @@ function encryptFollowingDefuse($message, $ascii_key) `bloquer_modification` tinyint(1) NOT null DEFAULT '0', `personal_folder` tinyint(1) NOT null DEFAULT '0', `renewal_period` int(5) NOT null DEFAULT '0', - `fa_icon` VARCHAR(100) NOT NULL DEFAULT 'fa-folder', - `fa_icon_selected` VARCHAR(100) NOT NULL DEFAULT 'fa-folder-open', + `fa_icon` VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder', + `fa_icon_selected` VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder-open', PRIMARY KEY (`id`), KEY `nested_tree_parent_id` (`parent_id`), KEY `nested_tree_nleft` (`nleft`), diff --git a/install/upgrade_run_3.0.0.php b/install/upgrade_run_3.0.0.php index 8c7567410..dd2a33dee 100755 --- a/install/upgrade_run_3.0.0.php +++ b/install/upgrade_run_3.0.0.php @@ -603,7 +603,7 @@ $res = addColumnIfNotExist( $pre . 'nested_tree', 'fa_icon', - "VARCHAR(100) NOT NULL DEFAULT 'fa-folder'" + "VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder'" ); if ($res === false) { echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon to table NESTED_TREE! ' . mysqli_error($db_link) . '!"}]'; @@ -614,7 +614,7 @@ $res = addColumnIfNotExist( $pre . 'nested_tree', 'fa_icon_selected', - "VARCHAR(100) NOT NULL DEFAULT 'fa-folder-open'" + "VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder-open'" ); if ($res === false) { echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon_selected to table NESTED_TREE! ' . mysqli_error($db_link) . '!"}]'; @@ -645,8 +645,18 @@ //---> 3.0.0.13 -mysqli_num_rows(mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon` = 'fas fa-folder' WHERE fa_icon = 'fa-folder'")); -mysqli_num_rows(mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon_selected` = 'fas fa-folder-open' WHERE fa_icon_selected = 'fa-folder-open'")); +mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon` = 'fas fa-folder' WHERE fa_icon = 'fa-folder'"); +mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon_selected` = 'fas fa-folder-open' WHERE fa_icon_selected = 'fa-folder-open'"); + +// Alter table nested_tree +mysqli_query( + $db_link, + "ALTER TABLE `" . $pre . "nested_tree` CHANGE `fa_icon` `fa_icon` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder';" +); +mysqli_query( + $db_link, + "ALTER TABLE `" . $pre . "nested_tree` CHANGE `fa_icon_selected` `fa_icon_selected` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder-open';" +); //---< diff --git a/pages/items.js.php b/pages/items.js.php index b686685b1..e5ebd14ad 100644 --- a/pages/items.js.php +++ b/pages/items.js.php @@ -484,6 +484,9 @@ function(teampassApplication) { if (selectedFolder.parent !== undefined && selectedFolder.parent !== '') { $('#form-folder-add-parent').val(selectedFolder.parent.split('_')[1]).change(); } + + $('#form-folder-add-label, #form-folder-add-parent').prop('disabled', false); + $('#form-folder-add-label') .val('') .focus(); @@ -526,7 +529,9 @@ function(teampassApplication) { .val(store.get('teampassApplication').selectedFolderParentTitle) .focus(); // is PF 1st level - if (store.get('teampassApplication').selectedFolderIsPF === 1 || store.get('teampassApplication').userCanEdit === 0) { + if (store.get('teampassApplication').selectedFolderIsPF === 1 && store.get('teampassApplication').selectedFolderParentId !== 0) { + $('#form-folder-add-label, #form-folder-add-parent').prop('disabled', false); + } else if (store.get('teampassApplication').userCanEdit === 0) { $('#form-folder-add-label, #form-folder-add-parent').prop('disabled', true); } else { $('#form-folder-add-label, #form-folder-add-parent').prop('disabled', false); diff --git a/sources/import.queries.php b/sources/import.queries.php index 5713ea23a..be6e37919 100644 --- a/sources/import.queries.php +++ b/sources/import.queries.php @@ -243,7 +243,7 @@ fclose($fp); } else { echo prepareExchangedData( - $SETTINGS['cpassman_dir'], + $SETTINGS['cpassman_dir'], array( 'error' => true, 'message' => langHdl('cannot_open_file'), @@ -272,7 +272,7 @@ // Show results to user. echo prepareExchangedData( - $SETTINGS['cpassman_dir'], + $SETTINGS['cpassman_dir'], array( 'error' => false, 'message' => '', diff --git a/sources/items.queries.php b/sources/items.queries.php index 6ccb18a47..cbc58df0c 100644 --- a/sources/items.queries.php +++ b/sources/items.queries.php @@ -5975,7 +5975,7 @@ // Build array $arr_data['folders'][$inc]['id'] = intval($folder->id); $arr_data['folders'][$inc]['level'] = intval($folder->nlevel); - $arr_data['folders'][$inc]['title'] = ($folder->title === $_SESSION['user_id'] && (int) $folder->nlevel === 1) ? htmlspecialchars_decode($_SESSION['login']) : htmlspecialchars_decode($folder->title, ENT_QUOTES); + $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'] = intval($folder->parent_id); $arr_data['folders'][$inc]['perso'] = intval($folder->personal_folder); diff --git a/sources/users.queries.php b/sources/users.queries.php index 11897b97d..c73b134ca 100644 --- a/sources/users.queries.php +++ b/sources/users.queries.php @@ -2686,6 +2686,8 @@ 'bloquer_creation' => '0', 'bloquer_modification' => '0', 'personal_folder' => '1', + 'fa_icon' => 'fas fa-folder', + 'fa_icon_selected' => 'fas fa-folder-open', ) );