From ced80503172da172f15b76710b34b357be6fbeb1 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 5 Jun 2017 12:50:22 +0200 Subject: [PATCH] Decode html entities in module plugin selector for edit bulk operation - #959 --- .../godmode/massive/massive_edit_plugins.php | 4 ++++ pandora_console/include/javascript/pandora.js | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/pandora_console/godmode/massive/massive_edit_plugins.php b/pandora_console/godmode/massive/massive_edit_plugins.php index aa6c414ed7..f14120de40 100644 --- a/pandora_console/godmode/massive/massive_edit_plugins.php +++ b/pandora_console/godmode/massive/massive_edit_plugins.php @@ -911,6 +911,10 @@ echo ''; try { var agentsFiltered = agentsFilteredWithAgents(agents, ids); var modules = moduleNamesFromAgents(agentsFiltered); + + for (var i = 0; i < modules.length; i++) { + modules[i] = htmlDecode(modules[i]); + } fillModules(modules, modulesSelected); } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index e9d12424b0..415bd913ea 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1184,3 +1184,13 @@ var autoHideElement = function (element, hideTime) { // Start hide startHideTimeout(hideTime); } + +function htmlEncode(value){ + // Create a in-memory div, set its inner text (which jQuery automatically encodes) + // Then grab the encoded contents back out. The div never exists on the page. + return $('
').text(value).html(); +} + +function htmlDecode(value){ + return $('
').html(value).text(); +} \ No newline at end of file