From 577a92f09fffe374262c20283371347f13595360 Mon Sep 17 00:00:00 2001 From: LAUMAILLE Nils <298792@dom2.ad.sys> Date: Mon, 30 Jan 2017 12:12:51 +0100 Subject: [PATCH] 2.1.27 Fix for #1628, #1627 Implemented item change proposal (#1625) --- changelog.md | 3 + folders.php | 2 +- includes/language/english.php | 1 + index.php | 2 +- install/install.queries.php | 2 +- install/upgrade_run_2.1.27.php | 2 +- items.load.php | 32 +++++---- items.php | 37 +++++------ load.php | 28 ++++++++ sources/folders.queries.php | 1 + sources/items.queries.php | 33 +++++++--- sources/main.queries.php | 23 +++++++ sources/suggestion.queries.php | 115 +++++++++++++++++++++++++++++---- suggestion.load.php | 36 +++++++++-- 14 files changed, 251 insertions(+), 66 deletions(-) diff --git a/changelog.md b/changelog.md index b72d1ad0b..33d991eda 100755 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,9 @@ Last changes - copy from public to personal folder - list of folders is refreshed when copying an Item # Copy folders + #1628 URL link to specific item does not work + #1627 Improved label preview length + #1625 Request to add/change password #1624 Error 500 while importing item with API (with PHP < 7) #1621 New option: OTV can be disabled # New option: create Item without password diff --git a/folders.php b/folders.php index fbbc8f067..aa4606f13 100644 --- a/folders.php +++ b/folders.php @@ -45,7 +45,7 @@ // prepare options list $prev_level = 0; $droplist = ''; -if ($_SESSION['is_admin'] == 1 || $_SESSION['can_create_root_folder'] == 1) { +if ($_SESSION['is_admin'] === "1" || $_SESSION['user_manager'] === "1" || $_SESSION['can_create_root_folder'] === "1") { $droplist .= ''; } foreach ($tst as $t) { diff --git a/includes/language/english.php b/includes/language/english.php index 6d08aa555..d2b91f8f0 100644 --- a/includes/language/english.php +++ b/includes/language/english.php @@ -14,6 +14,7 @@ */ global $LANG; $LANG = array ( + 'Dont_update_with_this_data' => 'Don\'t update item with this data', 'show_suggestions' => 'New suggestions', 'show_changes' => 'Change proposals', 'suggest_password_change' => 'Suggest a password change', diff --git a/index.php b/index.php index 09273f0e7..a442776d6 100644 --- a/index.php +++ b/index.php @@ -203,7 +203,7 @@ ) { echo ' - + '; } // Admin menu diff --git a/install/install.queries.php b/install/install.queries.php index 6de261c66..53408f4a3 100644 --- a/install/install.queries.php +++ b/install/install.queries.php @@ -807,7 +807,7 @@ function bCrypt($password, $cost) `id` tinyint(10) NOT NULL AUTO_INCREMENT, `item_id` tinyint(12) NOT NULL, `label` varchar(255) NOT NULL DEFAULT 'none', - `pwd` text NOT NULL, + `pw` text NOT NULL, `login` varchar(255) NOT NULL DEFAULT 'none', `email` varchar(255) NOT NULL DEFAULT 'none', `url` varchar(255) NOT NULL DEFAULT 'none', diff --git a/install/upgrade_run_2.1.27.php b/install/upgrade_run_2.1.27.php index 58cd6e9ab..f4599c093 100644 --- a/install/upgrade_run_2.1.27.php +++ b/install/upgrade_run_2.1.27.php @@ -447,7 +447,7 @@ function replace_a_line($data) { `id` tinyint(10) NOT NULL AUTO_INCREMENT, `item_id` tinyint(12) NOT NULL, `label` varchar(255) NOT NULL DEFAULT 'none', - `pwd` text NOT NULL, + `pw` text NOT NULL, `login` varchar(255) NOT NULL DEFAULT 'none', `email` varchar(255) NOT NULL DEFAULT 'none', `url` varchar(255) NOT NULL DEFAULT 'none', diff --git a/items.load.php b/items.load.php index 6d0e136c8..63df2c224 100755 --- a/items.load.php +++ b/items.load.php @@ -1077,7 +1077,7 @@ function AddNewFolder() { if ($("#new_rep_titre").val() == "") { $("#new_rep_show_error").html("").show(); - } else if ($("#new_rep_groupe").val() == "0") { + } else if ($("#new_rep_groupe").val() === "") { $("#new_rep_show_error").html("").show(); } else if ($("#new_rep_complexite").val() == "") { $("#new_rep_show_error").html("").show(); @@ -1181,13 +1181,15 @@ function(data) { function AfficherDetailsItem(id, salt_key_required, expired_item, restricted, display, open_edit, reload, id_tree) { - console.log(id+"--"+("#request_ongoing").val()); // If a request is already launched, then kill new. if ($("#request_ongoing").val() !== "") { request.abort(); return; } id_tree = id_tree || ""; + salt_key_required = salt_key_required || 0; + id_tree = id_tree || ""; + id_tree = id_tree || ""; // Store status query running $("#request_ongoing").val("1"); @@ -2275,17 +2277,14 @@ function(data) { data = prepareExchangedData(data , "decode", ""); //check if format error if (data.error == "") { - // clear list (except the entries with value = 0) - $('#new_rep_groupe option[value!="0"]').remove(); - $('#edit_folder_folder option[value!="0"]').remove(); - $('#move_folder_id option[value!="0"]').remove(); - $('#delete_rep_groupe option[value!="0"]').remove(); - $('#copy_in_folder option[value!="0"]').remove(); - // append new list $("#categorie, #edit_categorie, #new_rep_groupe, #edit_folder_folder, #delete_rep_groupe").find('option').remove().end().append(data.selectVisibleFoldersOptions); $("#move_folder_id").find('option').remove().end().append(data.selectFullVisibleFoldersOptions); $("#copy_in_folder").find('option').remove().end().append(data.selectVisibleActiveFoldersOptions); + + // remove ROOT option if exists + $('#edit_folder_folder option[value="0"]').remove(); + $('#delete_rep_groupe option[value="0"]').remove(); } } ); @@ -2483,7 +2482,7 @@ function(data) { bgiframe: true, modal: true, autoOpen: false, - width: 350, + width: 490, height: 280, title: "", buttons: { @@ -3112,7 +3111,13 @@ function(data) { }, function(data) { if (data[0].error === "") { - $("#div_suggest_change_wait").html("").show(1).delay(2000).fadeOut(1000); + $("#div_suggest_change_wait").html("").show(1).delay(1500).fadeOut(1000); + setTimeout( + function() { + $("#div_suggest_change").dialog("close"); + }, + 500 + ); } }, "json" @@ -3374,9 +3379,8 @@ function(data) { } //Load item if needed and display items list - if ($("#open_id").val() !== "") {console.log(">> open "+$("#open_id").val()); - AfficherDetailsItem($("#open_id").val(), "", "", "", "", "", "", ""); -console.log(">> suite1"); + if ($("#open_id").val() !== "") { + AfficherDetailsItem($("#open_id").val()); //refreshTree($("#hid_cat").val(), "0"); $("#open_item_by_get").val(""); } diff --git a/items.php b/items.php index dad55b666..936be70e5 100644 --- a/items.php +++ b/items.php @@ -100,12 +100,12 @@ echo ' - + '; } elseif (isset($_GET['group']) && !isset($_GET['id'])) { echo ''; echo ''; - echo ''; + echo ''; echo ''; } else { echo ''; @@ -151,7 +151,7 @@ (isset($_SESSION['settings']['allow_print']) && $_SESSION['settings']['allow_print'] == 1 && $_SESSION['user_admin'] != 1 && $_SESSION['temporary']['user_can_printout'] == true) ? '
  •   '.$LANG['print_out_menu_title'].'
  • ' : '' , (isset($_SESSION['settings']['settings_offline_mode']) && $_SESSION['settings']['settings_offline_mode'] == 1 && $_SESSION['user_admin'] != 1) ? '
  •   '.$LANG['offline_menu_title'].'
  • ' : '' , ' - +
    @@ -233,7 +233,7 @@ ', isset($_SESSION['settings']['enable_suggestion']) && $_SESSION['settings']['enable_suggestion'] == 1 ? '
  •   '.$LANG['suggest_password_change'].'
  • ' : '', ' - +
    @@ -415,7 +415,7 @@ // Line for FOLDERS echo ' - '; + '; // Line for LOGIN echo ' @@ -597,7 +597,7 @@ echo '
    - +
    '; // Line for LOGIN echo ' @@ -766,24 +766,23 @@ - + - - + '; echo '
    '.$LANG['label'].' :
    '.$LANG['sub_group_of'].' :
    '.$LANG['complex_asked'].' : -
    @@ -798,23 +797,22 @@ - + - + - +
    '.$LANG['new_label'].' :
    '.$LANG['group_select'].' :
    '.$LANG['complex_asked'].' : -