diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index ca9cbcac5..7b66eb1da 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -571,6 +571,14 @@ class Bootstrap */ public function streamFile($file, $download = false, $downloadFileName = '') { + $fileNameIni = $file; + + $browserCacheFilesUid = G::browserCacheFilesGetUid(); + + if ($browserCacheFilesUid != null) { + $file = str_replace(".$browserCacheFilesUid", null, $file); + } + $folderarray = explode('/', $file); $typearray = explode('.', basename($file)); $typefile = $typearray[count($typearray) - 1]; @@ -578,14 +586,7 @@ class Bootstrap //trick to generate the translation.language.js file , merging two files if (strtolower($typefile) == 'js' && $typearray[0] == 'translation') { - Bootstrap::sendHeaders($filename, 'text/javascript', $download, $downloadFileName); - if ($typearray[1] != "enterprise" && $typearray[1] != "pmCaseArchive") { - $arrayAux = array($typearray[0], $typearray[1], $typearray[count($typearray) - 1]); - - $filename = str_replace(implode(".", $typearray), implode(".", $arrayAux), $filename); - - $typearray = $arrayAux; - } + Bootstrap::sendHeaders($fileNameIni, "text/javascript", $download, $downloadFileName); $output = Bootstrap::streamJSTranslationFile($filename, $typearray[count($typearray) - 2]); @@ -596,7 +597,7 @@ class Bootstrap //trick to generate the big css file for ext style . if (strtolower($typefile) == 'css' && $folderarray[count($folderarray) - 2] == 'css') { - Bootstrap::sendHeaders($filename, 'text/css', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/css", $download, $downloadFileName); $output = Bootstrap::streamCSSBigFile($typearray[0]); echo $output; return; @@ -605,59 +606,59 @@ class Bootstrap if (file_exists($filename)) { switch (strtolower($typefile)) { case 'swf': - Bootstrap::sendHeaders($filename, 'application/x-shockwave-flash', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "application/x-shockwave-flash", $download, $downloadFileName); break; case 'js': - Bootstrap::sendHeaders($filename, 'text/javascript', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/javascript", $download, $downloadFileName); break; case 'htm': case 'html': - Bootstrap::sendHeaders($filename, 'text/html', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/html", $download, $downloadFileName); break; case 'htc': - Bootstrap::sendHeaders($filename, 'text/plain', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/plain", $download, $downloadFileName); break; case 'json': - Bootstrap::sendHeaders($filename, 'text/plain', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/plain", $download, $downloadFileName); break; case 'gif': - Bootstrap::sendHeaders($filename, 'image/gif', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "image/gif", $download, $downloadFileName); break; case 'png': - Bootstrap::sendHeaders($filename, 'image/png', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "image/png", $download, $downloadFileName); break; case 'jpg': - Bootstrap::sendHeaders($filename, 'image/jpg', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "image/jpg", $download, $downloadFileName); break; case 'css': - Bootstrap::sendHeaders($filename, 'text/css', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/css", $download, $downloadFileName); break; case 'xml': - Bootstrap::sendHeaders($filename, 'text/xml', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/xml", $download, $downloadFileName); break; case 'txt': - Bootstrap::sendHeaders($filename, 'text/html', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/html", $download, $downloadFileName); break; case 'doc': case 'pdf': case 'pm': case 'po': - Bootstrap::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "application/octet-stream", $download, $downloadFileName); break; case 'php': if ($download) { - Bootstrap::sendHeaders($filename, 'text/plain', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "text/plain", $download, $downloadFileName); } else { require_once ($filename); return; } break; case 'tar': - Bootstrap::sendHeaders($filename, 'application/x-tar', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "application/x-tar", $download, $downloadFileName); break; default: //throw new Exception ( "Unknown type of file '$file'. " ); - Bootstrap::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName); + Bootstrap::sendHeaders($fileNameIni, "application/octet-stream", $download, $downloadFileName); break; } } else { @@ -672,6 +673,7 @@ class Bootstrap if (substr($filename, -10) == "ext-all.js") { $filename = PATH_GULLIVER_HOME . 'js/ext/min/ext-all.js'; } + @readfile($filename); } diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 15404e913..48229d133 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5080,21 +5080,19 @@ class G $arrayLibrary = array(); //Translations /js/ext/translation.en.js - $arrayLibrary["translation"] = ""; //Not use null + //Translations /js/ext/translation.xxx.en.js //xxx is an plugin + $arrayLibrary["translation"] = 1; //Not use null //Translation environment /jscore/labels/en.js - $translationEnvFilePath = PATH_DATA . "META-INF" . PATH_SEP . "translations.env"; - - if (file_exists($translationEnvFilePath)) { - $arrayData = unserialize(file_get_contents($translationEnvFilePath)); - $path = PATH_CORE . "js" . PATH_SEP . "labels" . PATH_SEP; + if (file_exists(PATH_DATA . "META-INF" . PATH_SEP . "translations.env")) { + $arrayData = unserialize(file_get_contents(PATH_DATA . "META-INF" . PATH_SEP . "translations.env")); foreach ($arrayData as $index1 => $value1) { foreach ($value1 as $index2 => $value2) { $record = $value2; - if (file_exists($path . $record["LOCALE"] . ".js")) { - $arrayLibrary[$record["LOCALE"]] = $path; + if (file_exists(PATH_CORE . "js" . PATH_SEP . "labels" . PATH_SEP . $record["LOCALE"] . ".js")) { + $arrayLibrary[$record["LOCALE"]] = 1; } } } @@ -5111,7 +5109,7 @@ class G $lib->build_js_to = $lib->build_js_to . "/"; } - $arrayLibrary[$lib->name] = PATH_TRUNK . $lib->build_js_to; + $arrayLibrary[$lib->name] = 1; } } @@ -5120,33 +5118,12 @@ class G public static function browserCacheFilesSetUid() { - //Set UID $uid = G::generateUniqueID(); $arrayData = array(); $arrayData["browser_cache_files_uid"] = $uid; G::update_php_ini(PATH_CONFIG . "env.ini", $arrayData); - - //Set file JavaScript - $arrayLibrary = G::browserCacheFilesGetLibraryJs(); - - foreach ($arrayLibrary as $index => $value) { - $name = $index; - $path = $value; - - if (!empty($path)) { - foreach (glob($path . $name . "*") as $file) { - if (preg_match("/^\.\w{32}\.js$/i", str_replace($path . $name, null, $file))) { - @unlink($file); //Delete old file - } - } - - if (file_exists($path . $name . ".js")) { - @copy($path . $name . ".js", $path . $name . "." . $uid . ".js"); //Create new file - } - } - } } public static function browserCacheFilesGetUid() @@ -5175,20 +5152,7 @@ class G $arrayLibrary = G::browserCacheFilesGetLibraryJs(); if (isset($arrayLibrary[$index])) { - $path = $arrayLibrary[$index]; - $sw = 0; - - if (!empty($path)) { - if (file_exists($path . $arrayMatch[1] . "." . $browserCacheFilesUid . ".js")) { - $sw = 1; - } - } else { - $sw = 1; - } - - if ($sw == 1) { - $url = str_replace($name, $arrayMatch[1] . "." . $browserCacheFilesUid . ".js", $url); - } + $url = str_replace($name, $arrayMatch[1] . "." . $browserCacheFilesUid . ".js", $url); } } } diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index 4a7e1d8b1..f1c1f4191 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -214,11 +214,9 @@ class headPublisher $head = ''; $head .= '