Skip to content

Commit c558979

Browse files
committed
Added double encoding for already existing HTMl entities
Added encoding into HTML-ENTITIES Added revert back into UTF-8 Changed version to 3.2.5
1 parent f6fb74f commit c558979

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

front/processmaker.helpdesk.form.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,17 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
583583

584584
// to change this HTML code
585585
$dom = new DOMDocument();
586-
$dom->loadHTML($buffer, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOXMLDECL);
586+
587+
// will convert '&' to '&amp;', '<' to '&lt;' and '>' to '&gt;'
588+
$buffer = htmlspecialchars($buffer, ENT_NOQUOTES);
589+
// will restore '&lt;' to '<' and '&gt;' to '>'
590+
// so that only the already escaped entites will get the double encoding
591+
$buffer = str_replace(['&lt;', '&gt;'], ['<', '>'], $buffer);
592+
593+
// will convert any UTF-8 char that can't be expressed in ASCII into an HTML entity
594+
$buffer = mb_convert_encoding($buffer, 'HTML-ENTITIES');
595+
596+
$dom->loadHTML($buffer, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
587597
$xpath = new DOMXPath($dom);
588598

589599
// hide some fields
@@ -606,8 +616,8 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
606616
$elt->setAttribute( 'colspan', '2');
607617
}
608618

609-
//$res = $xpath->query('//*[@name="content"]/ancestor::tr[1]');
610-
$res = $xpath->query('//*[@name="add"]/ancestor::tr[@class="tab_bg_1"]/preceding-sibling::tr[1]');
619+
$res = $xpath->query('//*[@name="content"]/ancestor::tr[1]');
620+
//$res = $xpath->query('//*[@name="add"]/ancestor::tr[@class="tab_bg_1"]/preceding-sibling::tr[1]');
611621
$table = $xpath->query('//*[@name="add"]/ancestor::table[1]');
612622

613623
$tr = $table->item(0)->insertBefore(new DOMElement('tr'), $res->item(0));
@@ -634,8 +644,9 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
634644

635645
$buffer = $dom->saveHTML();
636646

647+
// will revert back any char converted above
648+
$buffer = mb_convert_encoding($buffer, 'UTF-8', 'HTML-ENTITIES');
637649
echo $buffer;
638-
//showFormHelpdesk($ID, $pmItem, $caseInfo);
639650
}
640651

641652
}

inc/processmaker.class.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,4 +2704,22 @@ static private function displayMessage($html_message, $title='',$msgtype='info_m
27042704

27052705
echo Html::scriptBlock($scriptblock);
27062706
}
2707+
2708+
//static protected $saved_ob_level;
2709+
2710+
//static function pre_item_form_processmakerticket($item) {
2711+
// self::$saved_ob_level = ob_get_level();
2712+
// ob_start();
2713+
2714+
//}
2715+
2716+
//static function post_item_form_processmakerticket($item) {
2717+
// $buffer = ob_get_clean();
2718+
// // 9.1 only: hack to fix an issue with the initEditorSystem which calls scriptStart without calling scriptEnd
2719+
// if (ob_get_level() > self::$saved_ob_level) {
2720+
// $buffer = ob_get_clean().$buffer;
2721+
// }
2722+
// echo $buffer;
2723+
//}
2724+
27072725
}

js/cases.helpdesk.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function onClickContinue(obj) {
1414
}
1515

1616
// call old handler if any
17+
//debugger;
1718
if (obj != undefined && oldHandler) {
1819
oldHandler(obj.target);
1920
}
@@ -65,15 +66,10 @@ function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
6566
//debugger;
6667

6768
bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN');
68-
69-
//buttonContinue.form.action = null; //'';
70-
//if (buttonContinue.addEventListener)
71-
// buttonContinue.addEventListener("click", onClickContinue, false);
72-
//else
73-
// buttonContinue.attachEvent("onclick", onClickContinue);
69+
7470
oldHandler = buttonContinue.onclick;
7571
buttonContinue.onclick = onClickContinue;
76-
72+
7773
submitButton = $("input[name='add'][type=submit]")[0];
7874
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_action' value='routecase'/>");
7975
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_caseid' value='" + caseId + "'/>");

processmaker.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
</authors>
2424
<versions>
2525
<version>
26-
<num>3.2.4</num>
26+
<num>3.2.5</num>
2727
<compatibility>9.2</compatibility>
2828
</version>
2929
<version>
30-
<num>3.2.4</num>
30+
<num>3.2.5</num>
3131
<compatibility>9.1</compatibility>
3232
</version>
3333
</versions>

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function plugin_version_processmaker() {
119119
global $LANG;
120120

121121
return array ('name' => 'Process Maker',
122-
'version' => '3.2.4',
122+
'version' => '3.2.5',
123123
'author' => 'Olivier Moron',
124124
'homepage' => 'https://github.com/tomolimo/processmaker',
125125
'minGlpiVersion' => '9.1');

0 commit comments

Comments
 (0)