Skip to content

Commit b897c9f

Browse files
Merge branch 'development'
2 parents e955e6c + 8a26d9c commit b897c9f

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

install/install.queries.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function chmod_r($dir, $dirPermissions, $filePermissions) {
246246
`email` varchar(100) DEFAULT NULL,
247247
`notification` varchar(250) DEFAULT NULL,
248248
`viewed_no` int(12) NOT null DEFAULT '0',
249-
`complexity_level` varchar(2) NOT null DEFAULT '-1',
249+
`complexity_level` varchar(3) NOT null DEFAULT '-1',
250250
`auto_update_pwd_frequency` tinyint(2) NOT null DEFAULT '0',
251251
`auto_update_pwd_next_date` int(15) DEFAULT NULL,
252252
PRIMARY KEY (`id`),

install/upgrade_run_2.1.26.php

+2
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,7 @@ function tableExists($tablename, $database = false)
143143
exit();
144144
}
145145

146+
// alter table Items
147+
mysqli_query($dbTmp, "ALTER TABLE `".$_SESSION['tbl_prefix']."items` MODIFY complexity_level VARCHAR(3)");
146148

147149
echo '[{"finish":"1" , "next":"", "error":""}]';

items.load.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ function(data) {
902902
$("#id_label").text($('#edit_label').val());
903903
//$("#id_pw").text($('#edit_pw1').val());
904904
$("#id_email").html($('#edit_email').val());
905-
$("#id_url").html($('#edit_url').val());
905+
$("#id_url").html($('#edit_url').val().escapeHTML());
906906
$("#id_desc").html(description);
907907
$("#id_login").html($('#edit_item_login').val());
908908
$("#id_restricted_to").html(data.list_of_restricted);
@@ -916,7 +916,7 @@ function(data) {
916916
$("#hid_label").val($('#edit_label').val());
917917
$("#hid_pw").val($('#edit_pw1').val());
918918
$("#hid_email").val($('#edit_email').val());
919-
$("#hid_url").val($('#edit_url').val());
919+
$("#hid_url").val($('#edit_url').val().escapeHTML());
920920
$("#hid_desc").val(description);
921921
$("#hid_login").val($('#edit_item_login').val());
922922
$("#hid_restricted_to").val(restriction);
@@ -2124,7 +2124,7 @@ function(data) {
21242124
if (data[0].duplicate != "1") {
21252125
$("#div_formulaire_saisi ~ .ui-dialog-buttonpane").find("button:contains('<?php echo $LANG['save_button'];?>')").button("enable");
21262126
// display title
2127-
$("#"+textFieldId).html(itemTitle);
2127+
$("#"+textFieldId).html(itemTitle.escapeHTML());
21282128
} else {
21292129
$("#label").focus();
21302130
$("#new_show_error").html("<?php echo $LANG['duplicate_title_in_same_folder'];?>").show();
@@ -2133,7 +2133,7 @@ function(data) {
21332133
);
21342134
} else {
21352135
// display title
2136-
$("#"+textFieldId).html(itemTitle);
2136+
$("#"+textFieldId).html(itemTitle.escapeHTML());
21372137
}
21382138
}
21392139
}
@@ -3858,4 +3858,14 @@ function serverAutoChangePwd()
38583858
});
38593859
}
38603860

3861+
3862+
// escape HTML characters
3863+
String.prototype.escapeHTML = function() {
3864+
return this.replace(/&/g, "&amp;")
3865+
.replace(/</g, "&lt;")
3866+
.replace(/>/g, "&gt;")
3867+
.replace(/"/g, "&quot;")
3868+
.replace(/'/g, "&#039;");
3869+
}
3870+
38613871
</script>

sources/items.queries.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,12 @@
384384

385385
if (count($dataReceived) > 0) {
386386
// Prepare variables
387-
$label = htmlspecialchars_decode($dataReceived['label']);
388-
$url = htmlspecialchars_decode($dataReceived['url']);
387+
$label = noHTML(htmlspecialchars_decode($dataReceived['label']));
388+
$url = noHTML(htmlspecialchars_decode($dataReceived['url']));
389389
$pw = $original_pw = $sentPw = htmlspecialchars_decode($dataReceived['pw']);
390-
$login = htmlspecialchars_decode($dataReceived['login']);
390+
$login = noHTML(htmlspecialchars_decode($dataReceived['login']));
391391
$tags = htmlspecialchars_decode($dataReceived['tags']);
392+
$email = noHTML(htmlspecialchars_decode($dataReceived['email']));
392393
// Get all informations for this item
393394
$dataItem = DB::queryfirstrow(
394395
"SELECT *
@@ -486,7 +487,7 @@
486487
'description' => $dataReceived['description'],
487488
'pw' => $passwd['string'],
488489
'pw_iv' => $passwd['iv'],
489-
'email' => $dataReceived['email'],
490+
'email' => $email,
490491
'login' => $login,
491492
'url' => $url,
492493
'id_tree' => (!isset($dataReceived['categorie']) || $dataReceived['categorie'] == "undefined") ? $dataItem['id_tree'] : $dataReceived['categorie'],

sources/main.functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1312,5 +1312,5 @@ function get_client_ip_server() {
13121312
*/
13131313
function noHTML($input, $encoding = 'UTF-8')
13141314
{
1315-
return htmlentities($input, ENT_QUOTES | ENT_HTML5, $encoding);
1315+
return htmlspecialchars($input, ENT_QUOTES | ENT_HTML5, $encoding);
13161316
}

0 commit comments

Comments
 (0)