diff options
author | Christian Helbling | 2016-01-08 14:40:41 +0100 |
---|---|---|
committer | Christian Helbling | 2016-01-08 14:40:41 +0100 |
commit | f7abbe808fcbe761f869e116e499f0e8fe8d631b (patch) | |
tree | ca5f21bc5fde418090cf05cd331ba6f69d9d80c1 /itjs.class | |
parent | 5af90e3f1f13a964e950e4379492b68c2d8f2487 (diff) | |
parent | 7c4ad5b54006acc27b6dc22d3d746d15a2d14520 (diff) | |
download | itools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.tar.gz itools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.tar.bz2 itools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.zip |
Merge branch 'master' into cs/php7
Diffstat (limited to 'itjs.class')
-rw-r--r-- | itjs.class | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -115,7 +115,7 @@ static function encode($values) static function filenames($filelist) { $result = array(); - $path = $GLOBALS['ULTRAHOME'] . "/itjs"; + $local = $GLOBALS['ULTRAHOME'] . "/itjs"; $itjs = "/www/server/phpinclude/itools/itjs"; $libsearch = strlen($GLOBALS['debug_lib']) > 1 ? "/www/lib-" . $GLOBALS['debug_lib'] . ".search.ch" : "/www/lib.search.ch"; $special = array( @@ -124,19 +124,13 @@ static function filenames($filelist) "state.html" => "$itjs/state.html", "error.gif" => "$itjs/error.gif", "search.css" => "$libsearch/doc/search.css", - "searchlib.js" => "$libsearch/itjs/searchlib.js", - "sl_state.js" => "$libsearch/itjs/sl_state.js", - "sl_dropdown.js" => "$libsearch/itjs/sl_dropdown.js", - "sl_collapse.js" => "$libsearch/itjs/sl_collapse.js", - "sl_adid_debug.js" => "$libsearch/itjs/sl_adid_debug.js", - "locateme.js" => "$libsearch/itjs/locateme.js", "prettyprint.css" => "$libsearch/doc/prettyprint.css", "PIE.htc" => "$libsearch/doc/PIE.htc", ); - foreach (array_filter(explode(",", basename($filelist))) as $file) + foreach (it::match("[-\w.=?&]+", basename($filelist), array('all' => true)) as $file) # split by comma but ignore illegal chars { - $filenames = $special[$file] ?: (file_exists("$path/" . it::replace(array('[\?\x00].*' => ""), $file)) ? "$path/$file" : "$libsearch/itjs/$file"); + $filenames = $special[$file] ?: (file_exists("$local/$file") ? "$local/$file" : "$libsearch/itjs/$file"); foreach (explode(",", $filenames) as $filename) if (!$seen[$filename]++) @@ -198,7 +192,7 @@ static function checksum($fnlist, $p = array()) { $p += array('short_expire' => true); - $filenames = array_merge(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), array("/www/lib.search.ch/var/jquery-ui/dist/minified/jquery.ui.core.min.js", "/www/lib.search.ch/var/jquery/dist/jquery.min.js")); # jquery files included by lib/jquery.js + $filenames = array_merge(itjs::filenames(join(",", (array)$fnlist)), array("/www/lib.search.ch/var/jquery-ui/dist/minified/jquery.ui.core.min.js", "/www/lib.search.ch/var/jquery/dist/jquery.min.js")); # jquery files included by lib/jquery.js $key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames))); if ($p['short_expire'] && (time() - max(@array_map('filemtime', $filenames)) < 60)) @@ -210,7 +204,7 @@ static function checksum($fnlist, $p = array()) function crcurl($url, $p = array()) { if (it::match('^http', $url)) # remote url, must fetch to crc - list($fn, $short_expire) = array(it_url::get_cache(array('url' => $url, 'maxage' => 3600) + $p), false); + list($fn, $short_expire) = array(it_url::get_cache(array('url' => $url, 'maxage' => 3600, 'id' => "itjs_crcurl") + $p), false); else list($fn, $short_expire) = array(($m = it::match("^//(\w+)(/.*)", $url)) ? "/www/$m[0].search.ch" . $m[1] : $GLOBALS['ULTRAHOME'] . $url, true);; |