diff options
author | Christian Schneider | 2021-02-10 19:11:41 +0100 |
---|---|---|
committer | Christian Schneider | 2021-02-10 19:11:41 +0100 |
commit | c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1 (patch) | |
tree | 7a9751e7276796f6822439e5d5aa38f267a78c00 | |
parent | 47730d966bdd1d14e03fdba6f957cb9fb401b120 (diff) | |
download | itools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.tar.gz itools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.tar.bz2 itools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.zip |
Leave comments like NOCSSLINT in nostrip mode but restrict it to ULTRATRUSTED
-rw-r--r-- | itjs.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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, "<?php") !== false) it::error("sending php source?!"); -echo $_GET['nostrip'] ? $data : itjs::strip($data); +echo $nostrip ? $data : itjs::strip($data); |