Skip to content

Commit

Permalink
Handle htmlawed dependency using composer
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne authored and trasher committed Feb 15, 2019
1 parent 17cc629 commit 1afbd40
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 742 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"doctrine/annotations": "^1.4",
"twig/extensions": "^1.5",
"kanellov/slim-twig-flash": "^0.2.0",
"runcmf/runtracy": "^0.2.10"
"runcmf/runtracy": "^0.2.10",
"fossar/htmlawed": "1.2.4.1"
},
"require-dev": {
"guzzlehttp/guzzle": "~6",
Expand Down
51 changes: 50 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions inc/based_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@
define("GLPI_SCRIPT_DIR", GLPI_ROOT . "/scripts");
}

// Default patch to htmLawed
if (!defined('GLPI_HTMLAWED')) {
define('GLPI_HTMLAWED', GLPI_ROOT.'/lib/htmlawed/htmLawed.php');
// if htmLawed available in system, use (in config_path.php)
// define('GLPI_HTMLAWED', '/usr/share/htmlawed/htmLawed.php');
}

// Install mode for telemetry
if (!defined('GLPI_INSTALL_MODE')) {
if (is_dir(GLPI_ROOT . '/.git')) {
Expand Down
3 changes: 1 addition & 2 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1904,12 +1904,11 @@ static function getLibraryDir($libstring) {
* @since 9.4
*/
static function getLibraries($all = false) {
include_once(GLPI_HTMLAWED);
$pm = new PHPMailer();
$sp = new SimplePie();

// use same name that in composer.json
$deps = [[ 'name' => 'htmLawed',
$deps = [[ 'name' => 'fossar/htmlawed',
'version' => hl_version() ,
'check' => 'hl_version' ],
[ 'name' => 'phpmailer/phpmailer',
Expand Down
1 change: 0 additions & 1 deletion inc/html.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ static function clean($value, $striptags = true, $keep_bad = 2) {
// Neutralize not well formatted html tags
$value = preg_replace("/(<)([^>]*<)/", "&lt;$2", $value);

include_once(GLPI_HTMLAWED);
$value = htmLawed(
$value,
[
Expand Down
1 change: 0 additions & 1 deletion inc/toolbox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ static function unclean_cross_side_scripting_deep($value) {
* @see clean_cross_side_scripting_deep()
**/
static function unclean_html_cross_side_scripting_deep($value) {
include_once(GLPI_HTMLAWED);

$in = ['<', '>'];
$out = ['&lt;', '&gt;'];
Expand Down
Loading

0 comments on commit 1afbd40

Please sign in to comment.