From c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 10 Feb 2021 19:11:41 +0100 Subject: Leave comments like NOCSSLINT in nostrip mode but restrict it to ULTRATRUSTED --- itjs.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'itjs.php') diff --git a/itjs.php b/itjs.php index db9c642..68f1213 100644 --- a/itjs.php +++ b/itjs.php @@ -35,6 +35,7 @@ if (it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT'])) $files = itjs::filenames($_GET['files'] ?: it::match('/itjs/([-a-z0-9_,.]*)', $_SERVER['PHP_SELF'])); $data = itjs::filecontents($files); $lastfile = end($files) ?: it::match('[^,]+$', $_GET['files']); # set correct mime type even if files not found +$nostrip = $_GET['nostrip'] && $GLOBALS['ULTRATRUSTED']; if (it::match('\.gif$', $lastfile)) { @@ -44,7 +45,7 @@ else if (it::match('\.css', $lastfile)) { header("Content-Type: text/css"); if (!it::match('^devel', $GLOBALS['ULTRASERVERTYPE'])) - $data = it::replace(array('[ \t]*([{};])[ \t]*' => '$1', '/\*.*?\*/' => ""), $data); + $data = it::replace(array('[ \t]*([{};])[ \t]*' => '$1', ($nostrip ? '_LEAVE_COMMENTS_' : '/\*.*?\*/') => ""), $data); if (it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) || $_GET['w3c']) $data = it::replace(array( '@-.*|@page.*' => "", @@ -85,4 +86,4 @@ else if ($files && !it::match('\.html$', $lastfile)) if (strpos($data, "