Skip to content

Commit 5f16f6b

Browse files
2.1.27
Several fixes
1 parent c0b8b0f commit 5f16f6b

File tree

5 files changed

+244
-109
lines changed

5 files changed

+244
-109
lines changed

Diff for: index.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@
177177

178178
// Load user languages files
179179
if (in_array($session_user_language, $languagesList) === true) {
180-
require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php';
180+
if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php') === true) {
181+
require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php';
182+
}
181183
} else {
182184
$_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
183185
include $SETTINGS['cpassman_dir'].'/error.php';

Diff for: items.load.php

+52-35
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ function(data) {
290290
}
291291

292292
// store the categories to be displayed
293-
$("#display_categories").val(data.displayCategories);
293+
if (data.displayCategories !== undefined) {
294+
$("#display_categories").val(data.displayCategories);
295+
}
294296

295297
// store type of access on folder
296298
$("#access_level").val(data.access_level);
@@ -350,7 +352,7 @@ function(data) {
350352
$("#query_next_start").val(data.list_to_be_continued);
351353

352354
// display Categories if needed
353-
if ($(".tr_fields") != undefined && data.displayCategories != "") {
355+
if ($(".tr_fields") !== undefined && data.displayCategories !== undefined && data.displayCategories !== "") {
354356
var liste = data.displayCategories.split(';');
355357
for (var i=0; i<liste.length; i++) {
356358
$(".itemCatName_"+liste[i]+", #newItemCatName_"+liste[i]+", #editItemCatName_"+liste[i]).show();
@@ -382,7 +384,7 @@ function(data) {
382384
$("#query_next_start").val(data.list_to_be_continued);
383385

384386
// display Categories if needed
385-
if ($(".tr_fields") != undefined && data.displayCategories != "") {
387+
if ($(".tr_fields") != undefined && data.displayCategories !== undefined && data.displayCategories != "") {
386388
var liste = data.displayCategories.split(';');
387389
for (var i=0; i<liste.length; i++) {
388390
$(".itemCatName_"+liste[i]+", #newItemCatName_"+liste[i]+", #editItemCatName_"+liste[i]).show();
@@ -420,10 +422,10 @@ function(data) {
420422
$.post(
421423
"sources/items.queries.php",
422424
{
423-
type : "move_item",
424-
item_id : ui.draggable.attr("id"),
425+
type : "move_item",
426+
item_id : ui.draggable.attr("id"),
425427
folder_id : $(this).attr("id").substring(4),
426-
key : "<?php echo $_SESSION['key']; ?>"
428+
key : "<?php echo $_SESSION['key']; ?>"
427429
},
428430
function(data) {
429431
//increment / decrement number of items in folders
@@ -926,34 +928,40 @@ function(data) {
926928
}
927929

928930
//check if format error
929-
if (data.error == "ERR_JSON_FORMAT") {
931+
if (data.error === "ERR_JSON_FORMAT") {
930932
$("#div_loading").addClass("hidden");
931-
$("#edit_show_error").html(data.error + ' ERROR (JSON is broken)!!!!!');
932-
$("#edit_show_error").show();
933-
} else if (data.error == "ERR_KEY_NOT_CORRECT") {
933+
$("#edit_show_error")
934+
.html(data.error + ' ERROR (JSON is broken)!!!!!')
935+
.show();
936+
} else if (data.error === "ERR_KEY_NOT_CORRECT") {
934937
$("#div_loading").addClass("hidden");
935-
$("#edit_show_error").html('Key verification for Query is not correct!');
936-
$("#edit_show_error").show();
938+
$("#edit_show_error")
939+
.html('Key verification for Query is not correct!')
940+
.show();
937941
LoadingPage();
938-
}else if (data.error == "ERR_ENCRYPTION_NOT_CORRECT") {
942+
}else if (data.error === "ERR_ENCRYPTION_NOT_CORRECT") {
939943
$("#div_loading").addClass("hidden");
940-
$("#edit_show_error").html('Item password could not be correctly encrypted!');
941-
$("#edit_show_error").show();
944+
$("#edit_show_error")
945+
.html('Item password could not be correctly encrypted!')
946+
.show();
942947
LoadingPage();
943-
} else if (data.error == "ERR_PWD_TOO_LONG") {
948+
} else if (data.error === "ERR_PWD_TOO_LONG") {
944949
$("#div_loading").addClass("hidden");
945-
$("#edit_show_error").html('<?php echo addslashes($LANG['error_pw_too_long']); ?>');
946-
$("#edit_show_error").show();
950+
$("#edit_show_error")
951+
.html('<?php echo addslashes($LANG['error_pw_too_long']); ?>')
952+
.show();
947953
LoadingPage();
948-
} else if (data.error == "ERR_NOT_ALLOWED_TO_EDIT") {
954+
} else if (data.error === "ERR_NOT_ALLOWED_TO_EDIT") {
949955
$("#div_formulaire_saisi").dialog("open");
950-
$("#new_show_error").html('User not allowed to edit this Item!');
951-
$("#new_show_error").show();
956+
$("#new_show_error")
957+
.html('User not allowed to edit this Item!')
958+
.show();
952959
LoadingPage();
953-
} else if (data.error != "") {
960+
} else if (data.error !== "") {
954961
$("#div_loading").addClass("hidden");
955-
$("#edit_show_error").html('<?php echo addslashes($LANG['error_not_allowed_to']); ?>');
956-
$("#edit_show_error").show();
962+
$("#edit_show_error")
963+
.html('<?php echo addslashes($LANG['error_not_allowed_to']); ?>')
964+
.show();
957965
LoadingPage();
958966
} else {
959967
//refresh item in list
@@ -1268,19 +1276,23 @@ function AfficherDetailsItem(id, salt_key_required, expired_item, restricted, di
12681276
return;
12691277
} else {
12701278
$("#timestamp_item_displayed").val("");
1279+
var data = {
1280+
"id" : id,
1281+
"folder_id" : $('#hid_cat').val(),
1282+
"salt_key_required" : $('#recherche_group_pf').val(),
1283+
"salt_key_set" : $('#personal_sk_set').val(),
1284+
"expired_item" : expired_item,
1285+
"restricted" : restricted,
1286+
"page" : "items"
1287+
};
1288+
12711289
//Send query
12721290
$.post(
12731291
"sources/items.queries.php",
12741292
{
1275-
type : 'show_details_item',
1276-
id : id,
1277-
folder_id : $('#hid_cat').val(),
1278-
salt_key_required : $('#recherche_group_pf').val(),
1279-
salt_key_set : $('#personal_sk_set').val(),
1280-
expired_item : expired_item,
1281-
restricted : restricted,
1282-
page : "items",
1283-
key : "<?php echo $_SESSION['key']; ?>"
1293+
type : 'show_details_item',
1294+
data : prepareExchangedData(JSON.stringify(data), "encode", "<?php echo $_SESSION['key']; ?>"),
1295+
key : "<?php echo $_SESSION['key']; ?>"
12841296
},
12851297
function(data_raw) {
12861298
//decrypt data
@@ -1589,7 +1601,7 @@ function(data_raw) {
15891601
// continue loading data
15901602
showDetailsStep2(id, param);
15911603

1592-
} else if (data.show_details == "1" && data.show_detail_option == "2") {
1604+
} else if (data.show_details === "1" && data.show_detail_option === "2") {
15931605
$("#item_details_nok").addClass("hidden");
15941606
$("#item_details_ok").addClass("hidden");
15951607
$("#item_details_expired_full").show();
@@ -1658,6 +1670,11 @@ function(data) {
16581670
return;
16591671
}
16601672

1673+
if (data.error !== "") {
1674+
$("#div_dialog_message_text").html(data.error_text);
1675+
$("#div_dialog_message").show();
1676+
}
1677+
16611678
$("#item_history_log").html(htmlspecialchars_decode(data.history));
16621679
$("#edit_past_pwds").attr('title', htmlspecialchars_decode(data.history_of_pwds));
16631680
$("#edit_past_pwds_div").html(htmlspecialchars_decode(data.history_of_pwds));
@@ -2601,7 +2618,7 @@ function(data) {
26012618
$.post(
26022619
"sources/items.queries.php",
26032620
{
2604-
type : "update_rep",
2621+
type : "update_folder",
26052622
data : prepareExchangedData(JSON.stringify(data), "encode", "<?php echo $_SESSION['key']; ?>"),
26062623
key : "<?php echo $_SESSION['key']; ?>"
26072624
},

Diff for: sources/core.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ function redirect($url)
7171
if (isset($SETTINGS_EXT['pwComplexity']) === false) {
7272
// Pw complexity levels
7373
if (isset($_SESSION['user_language']) === true && $_SESSION['user_language'] !== "0") {
74-
require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
74+
if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php') === true) {
75+
require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
76+
}
7577
$SETTINGS_EXT['pwComplexity'] = array(
7678
0=>array(0, $LANG['complex_level0']),
7779
25=>array(25, $LANG['complex_level1']),

0 commit comments

Comments
 (0)