summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
authorChristian Schneider2021-02-10 19:11:41 +0100
committerChristian Schneider2021-02-10 19:11:41 +0100
commitc15dc159ceb37c4ee1cf378e1e9ac81aab1181f1 (patch)
tree7a9751e7276796f6822439e5d5aa38f267a78c00 /itjs.php
parent47730d966bdd1d14e03fdba6f957cb9fb401b120 (diff)
downloaditools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.tar.gz
itools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.tar.bz2
itools-c15dc159ceb37c4ee1cf378e1e9ac81aab1181f1.zip
Leave comments like NOCSSLINT in nostrip mode but restrict it to ULTRATRUSTED
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php5
1 files changed, 3 insertions, 2 deletions
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, "<?php") !== false)
it::error("sending php source?!");
-echo $_GET['nostrip'] ? $data : itjs::strip($data);
+echo $nostrip ? $data : itjs::strip($data);