summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2012-03-30 16:19:49 +0000
committerThomas BrĂ¼derli2012-03-30 16:19:49 +0000
commit9c39a2a23c81da0d36070a8cb030ed076cf69bec (patch)
tree75eaa1dc4717746f4696cb1663c5c9c1fdcb0d10 /itjs.php
parent3242f516a6c3e89fa898d96927746447e15d7750 (diff)
downloaditools-9c39a2a23c81da0d36070a8cb030ed076cf69bec.tar.gz
itools-9c39a2a23c81da0d36070a8cb030ed076cf69bec.tar.bz2
itools-9c39a2a23c81da0d36070a8cb030ed076cf69bec.zip
Make javascript delivery unicode-safe
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/itjs.php b/itjs.php
index 03073e9..f819cab 100644
--- a/itjs.php
+++ b/itjs.php
@@ -33,7 +33,7 @@ foreach ($files as $file)
{
ob_start(); # Needs to capture inside loop to guarantee file order
if (!(it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) && it::match('jquery-ui\.css', $file)))
- $data .= it::replace(array('^1$' => ""), @include($file));
+ $data .= it::replace(array('^1$' => ""), @include($file), array('utf8' => false));
$data .= ob_get_clean();
}
@@ -50,9 +50,8 @@ else if (it::match('\.css', $_SERVER['PHP_SELF']))
$data .= "\n#it_boot_dom { display:none }\n"; # Append magic style for it_boot
if (!it::match('^devel', $GLOBALS['ULTRASERVERTYPE']))
$data = it::replace(array('[ \t]*([{};])[ \t]*' => '$1', '/\*.*?\*/' => ""), $data);
- if (it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) || EDC('w3c')) {
+ if (it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) || EDC('w3c'))
$data = it::replace(array('@-.*' => "", 'background[^;}]*(gradient|rgba)[^;}]*;?' => "", '(filter:\s*(progid|none)|text-overflow:|zoom:|-webkit-|display:-moz-|-moz-|-o-|cursor:|border-radius:|behavior:|\w+:expression)[^;}]*;?' => "", 'html\.ie6.*' => "", '([^/])\*(\w)' => '$1$2'), $data);
- }
}
else if (it::match('\.htc$', $file))
{
@@ -64,7 +63,8 @@ else if (!it::match('\.html$', $file))
if ($_REQUEST['boot'] && !$_REQUEST['retry'])
ob_start('ob_gzhandler');
- header("Content-Type: application/x-javascript; charset=iso-8859-1");
+ $charset = ini_get('default_charset') ?: 'iso-8859-1';
+ header("Content-Type: application/x-javascript; charset=$charset");
}
@header("Etag: $checksum");
@@ -80,7 +80,7 @@ if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH'])
{
$data .= "window.it_boot_init();\n";
if (!$_REQUEST['script'])
- $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code
+ $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", grapheme_strlen($data), strtr($data, array('%' => "%25", '.' => "%2e", 'e' => "%65", 'i' => "%69")), grapheme_strlen($data)); # Protect from Firewalls/Proxies altering Javascript source code
}
echo it_untaint($data);