Skip to content

Commit

Permalink
2.1.27
Browse files Browse the repository at this point in the history
Fix for #1628, #1627
Implemented item change proposal (#1625)
  • Loading branch information
LAUMAILLE Nils committed Jan 30, 2017
1 parent 6d98e65 commit 577a92f
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 66 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// prepare options list
$prev_level = 0;
$droplist = '<option value="na">---'.$LANG['select'].'---</option>';
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 .= '<option value="0">'.$LANG['root'].'</option>';
}
foreach ($tst as $t) {
Expand Down
1 change: 1 addition & 0 deletions includes/language/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
) {
echo '
<a class="btn btn-default" href="#" onclick="MenuAction(\'suggestion\')">
<i class="fa fa-lightbulb-o fa-2x tip" title="'.$LANG['suggestion_menu'].'"></i>
<i class="fa fa-lightbulb-o fa-2x tip" id="menu_icon_suggestions" title="'.$LANG['suggestion_menu'].'"></i>
</a>';
}
// Admin menu
Expand Down
2 changes: 1 addition & 1 deletion install/install.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion install/upgrade_run_2.1.27.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
32 changes: 18 additions & 14 deletions items.load.php
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ function AddNewFolder()
{
if ($("#new_rep_titre").val() == "") {
$("#new_rep_show_error").html("<?php echo addslashes($LANG['error_group_label']);?>").show();
} else if ($("#new_rep_groupe").val() == "0") {
} else if ($("#new_rep_groupe").val() === "") {
$("#new_rep_show_error").html("<?php echo addslashes($LANG['error_group_noparent']);?>").show();
} else if ($("#new_rep_complexite").val() == "") {
$("#new_rep_show_error").html("<?php echo addslashes($LANG['error_group_complex']);?>").show();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -2275,17 +2277,14 @@ function(data) {
data = prepareExchangedData(data , "decode", "<?php echo $_SESSION['key'];?>");
//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();
}
}
);
Expand Down Expand Up @@ -2483,7 +2482,7 @@ function(data) {
bgiframe: true,
modal: true,
autoOpen: false,
width: 350,
width: 490,
height: 280,
title: "<?php echo $LANG['item_menu_edi_rep'];?>",
buttons: {
Expand Down Expand Up @@ -3112,7 +3111,13 @@ function(data) {
},
function(data) {
if (data[0].error === "") {
$("#div_suggest_change_wait").html("<?php echo $LANG['suggestion_done'];?>").show(1).delay(2000).fadeOut(1000);
$("#div_suggest_change_wait").html("<?php echo $LANG['suggestion_done'];?>").show(1).delay(1500).fadeOut(1000);
setTimeout(
function() {
$("#div_suggest_change").dialog("close");
},
500
);
}
},
"json"
Expand Down Expand Up @@ -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("");
}
Expand Down
37 changes: 17 additions & 20 deletions items.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
echo '
<input type="hidden" name="open_folder" id="open_folder" value="'.htmlspecialchars($_GET['group']).'" />
<input type="hidden" name="open_id" id="open_id" value="'.htmlspecialchars($_GET['id']).'" />
<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array(htmlspecialchars($_GET['group']), $_SESSION['personal_visible_groups']) ? '1' : '', '" />
<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array(htmlspecialchars($_GET['group']), $_SESSION['personal_visible_groups']) ? '1' : '0', '" />
<input type="hidden" name="open_item_by_get" id="open_item_by_get" value="true" />';
} elseif (isset($_GET['group']) && !isset($_GET['id'])) {
echo '<input type="hidden" name="open_folder" id="open_folder" value="'.htmlspecialchars($_GET['group']).'" />';
echo '<input type="hidden" name="open_id" id="open_id" value="" />';
echo '<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array(htmlspecialchars($_GET['group']), $_SESSION['personal_visible_groups']) ? '1' : '', '" />';
echo '<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array(htmlspecialchars($_GET['group']), $_SESSION['personal_visible_groups']) ? '1' : '0', '" />';
echo '<input type="hidden" name="open_item_by_get" id="open_item_by_get" value="" />';
} else {
echo '<input type="hidden" name="open_folder" id="open_folder" value="" />';
Expand Down Expand Up @@ -151,7 +151,7 @@
(isset($_SESSION['settings']['allow_print']) && $_SESSION['settings']['allow_print'] == 1 && $_SESSION['user_admin'] != 1 && $_SESSION['temporary']['user_can_printout'] == true) ? '<li onclick="loadExportDialog()"><i class="fa fa-cloud-download fa-fw"></i>&nbsp; '.$LANG['print_out_menu_title'].'</li>' : '' ,
(isset($_SESSION['settings']['settings_offline_mode']) && $_SESSION['settings']['settings_offline_mode'] == 1 && $_SESSION['user_admin'] != 1) ? '<li onclick="loadOfflineDialog()"><i class="fa fa-laptop fa-fw"></i>&nbsp; '.$LANG['offline_menu_title'].'</li>' : '' , '
</ul>
</li>
</li>
</ul>
</div>
<div style="margin:3px 0px 10px 18px;font-weight:bold;">
Expand Down Expand Up @@ -233,7 +233,7 @@
', isset($_SESSION['settings']['enable_suggestion']) && $_SESSION['settings']['enable_suggestion'] == 1 ? '
<li onclick="OpenDialog(\'div_suggest_change\', \'false\')"><i class="fa fa-random fa-fw"></i>&nbsp; '.$LANG['suggest_password_change'].'</li>' : '', '
</ul>
</li>
</li>
</ul>
</div>
<div id="id_label" style="display:inline; margin:4px 0px 0px 120px; "></div>
Expand Down Expand Up @@ -415,7 +415,7 @@
// Line for FOLDERS
echo '
<label for="" class="">'.$LANG['group'].' : </label>
<select name="categorie" id="categorie" onchange="RecupComplexite(this.value,0)" style="width:200px"><option style="display: none;"></option></select>';
<select name="categorie" id="categorie" onchange="RecupComplexite(this.value,0)" style="width:250px; padding:3px;" class="ui-widget-content"><option style="display: none;"></option></select>';
// Line for LOGIN
echo '
<label for="" class="label_cpm" style="margin-top:10px;">'.$LANG['login'].' : </label>
Expand Down Expand Up @@ -597,7 +597,7 @@
echo '
<div style="margin:10px 0px 10px 0px;">
<label for="" class="">'.$LANG['group'].' : </label>
<select id="edit_categorie" onchange="RecupComplexite(this.value,1)" style="width:200px;"><option style="display: none;"></option></select>
<select id="edit_categorie" onchange="RecupComplexite(this.value,1)" style="width:250px; padding:3px;" class="ui-widget-content"><option style="display: none;"></option></select>
</div>';
// Line for LOGIN
echo '
Expand Down Expand Up @@ -766,24 +766,23 @@
<table>
<tr>
<td>'.$LANG['label'].' : </td>
<td><input type="text" size="20" id="new_rep_titre" /></td>
<td><input type="text" id="new_rep_titre" style="width:242px; padding:3px;" class="ui-widget-content" /></td>
</tr>
<tr>
<td>'.$LANG['sub_group_of'].' : </td>
<td><select id="new_rep_groupe"><option style="display: none;"></option>
', (isset($_SESSION['settings']['can_create_root_folder']) && $_SESSION['settings']['can_create_root_folder'] == 1) ?
'<option value="0">---</option>' : '', '' .'
<td><select id="new_rep_groupe" style="width:250px; padding:3px;" class="ui-widget-content">
', (isset($_SESSION['settings']['can_create_root_folder']) && $_SESSION['settings']['can_create_root_folder'] == 1) ? '<option value="0">'.$LANG['root'].'</option>' : '', '
</select></td>
</tr>
<tr>
<td>'.$LANG['complex_asked'].' : </td>
<td><select id="new_rep_complexite">';
<td><select id="new_rep_complexite" style="width:250px; padding:3px;" class="ui-widget-content">';
foreach ($_SESSION['settings']['pwComplexity'] as $complex) {
echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
}
echo '
</select>
</td>
</td>
</tr>';
echo '
</table>
Expand All @@ -798,23 +797,22 @@
<table>
<tr>
<td>'.$LANG['new_label'].' : </td>
<td><input type="text" size="20" id="edit_folder_title" /></td>
<td><input type="text" id="edit_folder_title" style="width:242px; padding:3px;" class="ui-widget-content" /></td>
</tr>
<tr>
<td>'.$LANG['group_select'].' : </td>
<td><select id="edit_folder_folder">
<option value="0">-choisir-</option></select></td>
<td><select id="edit_folder_folder" style="width:250px; padding:3px;" class="ui-widget-content"></select></td>
</tr>
<tr>
<td>'.$LANG['complex_asked'].' : </td>
<td><select id="edit_folder_complexity">
<td><select id="edit_folder_complexity" style="width:250px; padding:3px;" class="ui-widget-content">
<option value="">---</option>';
foreach ($_SESSION['settings']['pwComplexity'] as $complex) {
echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
}
echo '
</select>
</td>
</td>
</tr>
</table>
<div id="edit_folder_loader" style="display:none;text-align:center;margin-top:20px;">
Expand Down Expand Up @@ -858,8 +856,7 @@
<table>
<tr>
<td>'.$LANG['group_select'].' : </td>
<td><select id="delete_rep_groupe" onclick="">
<option value="0">-choisir-</option>
<td><select id="delete_rep_groupe" style="width:250px; padding:3px;" class="ui-widget-content">
</select></td>
</tr>
<tr>
Expand Down Expand Up @@ -900,7 +897,7 @@
<div>'.$LANG['item_copy_to_folder'].'</div>
<div style="margin:10px;">
<select id="copy_in_folder">
', (isset($_SESSION['can_create_root_folder']) && $_SESSION['can_create_root_folder'] == 1) ? '<option value="0">---</option>' : '', '' .
', (isset($_SESSION['can_create_root_folder']) && $_SESSION['can_create_root_folder'] == 1) ? '<option value="0">'.$LANG['root'].'</option>' : '', '' .
'</select>
</div>
<div style="height:20px;text-align:center;margin:2px;" id="copy_item_info" class=""></div>
Expand Down
28 changes: 28 additions & 0 deletions load.php
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,34 @@ function prepare_delete_fav(id)
$("#detele_fav_id").val(id);
OpenDialogBox("div_delete_fav");
}';
} else if (isset($_GET['page'])) {
// simulate a CRON activity (only 4 secs after page loading)
// check for existing suggestions / changes
$htmlHeaders .= '
setTimeout(
function() {
$.post(
"sources/main.queries.php",
{
type : "is_existings_suggestions",
key : "'.$_SESSION['key'].'"
},
function(data) {
//check if format error
if (data[0].error === "" && data[0].count > 0) {
$("#menu_icon_suggestions").addClass("mi-red");
setInterval(function(){blink()}, 700);
function blink() {
$("#menu_icon_suggestions").fadeTo(100, 0.1).fadeTo(200, 1.0);
}
}
},
"json"
);
},
4000
);';
}

$htmlHeaders .= '
Expand Down
1 change: 1 addition & 0 deletions sources/folders.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@
&& isset($_SESSION['settings']['subfolder_rights_as_parent'])
&& $_SESSION['settings']['subfolder_rights_as_parent'] == 1
&& $_SESSION['is_admin'] !== 0
|| ($isPersonal != 1 && $parentId === "0")
){
//Get user's rights
@identifyUserRights(
Expand Down
33 changes: 23 additions & 10 deletions sources/items.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@
);
$arrData['edit_item_salt_key'] = 0;
}

$pw = @$pw['string'];
if (!isUTF8($pw)) {
$pw = '';
Expand Down Expand Up @@ -2203,16 +2203,26 @@
} else {
$html .= '<span style="margin-left:11px;"></span>';
}
$html .= $expirationFlag.''.$perso.'&nbsp;<a id="fileclass'.$record['id'].'" class="file" onclick="'.$action.'">'.substr(stripslashes(handleBackslash($record['label'])), 0, 65);
if (!empty($record['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
$tempo = explode("<br />", $record['description']);
if (count($tempo) == 1) {
$html .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(substr(cleanString($record['description']), 0, 30))).']</font>';
} else {
$html .= '&nbsp;<font size="2px">['.strip_tags(stripslashes(substr(cleanString($tempo[0]), 0, 30))).']</font>';
}

// manage text to show
$label = stripslashes(handleBackslash($record['label']));
if (!empty($record['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] === "1") {
$desc = explode("<br>", $record['description']);
$desc = strip_tags(stripslashes(cleanString($desc[0])));
} else {
$desc = "";
}
if (strlen($label) >= 95 || $desc === "") {
$html .= $expirationFlag.''.$perso.'&nbsp;<a id="fileclass'.$record['id'].'" class="file" onclick="'.$action.'">'.substr($label, 0, 100);
} else if (strlen($label) < 95 && strlen($label) > 65) {
$item_text = substr($label, 0, 65);
$html .= $expirationFlag.''.$perso.'&nbsp;<a id="fileclass'.$record['id'].'" class="file" onclick="'.$action.'">'.$item_text.'&nbsp;<font size="1px">['.substr($desc, 0, 95 - strlen($label)).']</font>';
} else if (strlen($label) <= 65) {
$item_text = substr($label, 0, 65);
$html .= $expirationFlag.''.$perso.'&nbsp;<a id="fileclass'.$record['id'].'" class="file" onclick="'.$action.'">'.$item_text.'&nbsp;<font size="1px">['.substr($desc, 0, 95 - strlen($label)).']</font>';
}
$html .= '</a>';

// increment array for icons shortcuts (don't do if option is not enabled)
if (isset($_SESSION['settings']['copy_to_clipboard_small_icons']) && $_SESSION['settings']['copy_to_clipboard_small_icons'] == 1) {
if ($need_sk == true && isset($_SESSION['user_settings']['session_psk'])) {
Expand Down Expand Up @@ -3409,6 +3419,9 @@

// Build list of visible folders
$selectVisibleFoldersOptions = $selectVisibleNonPersonalFoldersOptions = $selectVisibleActiveFoldersOptions = "";
if (isset($_SESSION['settings']['can_create_root_folder']) && $_SESSION['settings']['can_create_root_folder'] == 1) {
$selectVisibleFoldersOptions = '<option value="0">'.$LANG['root'].'</option>';
}

if ($_SESSION['user_admin'] == 1 && (isset($k['admin_full_right'])
&& $k['admin_full_right'] == true) || !isset($k['admin_full_right'])) {
Expand Down Expand Up @@ -3661,7 +3674,7 @@
array(
'item_id' => $item_id,
'label' => $label,
'pwd' => $encrypt['string'],
'pw' => $encrypt['string'],
'login' => $login,
'email' => $email,
'url' => $url,
Expand Down
Loading

0 comments on commit 577a92f

Please sign in to comment.