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 .= '' . $this->title . "\n"; - $browserCacheFilesUid = G::browserCacheFilesGetUid(); - $head = $head . " "; @@ -310,12 +308,14 @@ class headPublisher public function includeExtJs() { $this->clearScripts(); - $head = ''; - $head .= " \n"; - $head .= " \n"; + + $head = ""; + $head = $head . " \n"; + $head = $head . " \n"; + $aux = explode('-', strtolower(SYS_LANG)); if (($aux[0] != 'en') && file_exists(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $aux[0] . '.js')) { - $head .= " \n"; + $head = $head . " \n"; } // enabled for particular use @@ -333,7 +333,7 @@ class headPublisher $head .= $this->getExtJsVariablesScript(); $oServerConf = & serverConf::getSingleton(); if ($oServerConf->isRtl(SYS_LANG)) { - $head .= " \n"; + $head = $head . " \n"; } return $head; @@ -374,7 +374,7 @@ class headPublisher $script = ''; if (isset($this->extJsScript) && is_array($this->extJsScript)) { foreach ($this->extJsScript as $key => $file) { - $script .= " \n"; + $script = $script . " \n"; } } return $script; @@ -410,7 +410,7 @@ class headPublisher $script = ''; if (isset($this->extJsLibrary) && is_array($this->extJsLibrary)) { foreach ($this->extJsLibrary as $file) { - $script .= " \n"; + $script = $script . " \n"; } } if (!in_array($this->translationsFile, $this->extJsLibrary)) { diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index f038cee67..c3277b202 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -138,8 +138,6 @@ try { $oStep = new Step(); $sUidGrids = $oStep->lookingforUidGrids( $sPRO_UID, $sDYNAFORM ); - $browserCacheFilesUid = G::browserCacheFilesGetUid(); - $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 3bf078603..006396b47 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -72,6 +72,7 @@ function transactionLog($transactionName){ newrelic_name_transaction ($transactionName); } } + // Defining the PATH_SEP constant, he we are defining if the the path separator symbol will be '\\' or '/' define( 'PATH_SEP', '/' ); @@ -316,6 +317,15 @@ if (! defined( 'PATH_C' )) { define( 'PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' ); } +//Call Gulliver Classes +Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class"); + +//Loading the autoloader libraries feature +spl_autoload_register(array("Bootstrap", "autoloadClass")); + +Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php"); +Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php"); + // defining Virtual URLs $virtualURITable = array (); $virtualURITable['/plugin/(*)'] = 'plugin'; @@ -405,6 +415,7 @@ if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath } die(); } + switch ($realPath) { case 'jsMethod': Bootstrap::parseURI( getenv( "REQUEST_URI" ) ); @@ -421,6 +432,7 @@ if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath die(); break; default: + //Process files loaded with tag head in HTML if (substr( $realPath, 0, 12 ) == 'rest-service') { $isRestRequest = true; } else { @@ -435,13 +447,6 @@ if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath } } //virtual URI parser -// Call Gulliver Classes -Bootstrap::LoadThirdParty( 'smarty/libs', 'Smarty.class' ); -//loading the autoloader libraries feature -spl_autoload_register(array('Bootstrap', 'autoloadClass')); -Bootstrap::registerClass('G', PATH_GULLIVER . "class.g.php"); -Bootstrap::registerClass('System', PATH_HOME . "engine/classes/class.system.php"); - // the request correspond to valid php page, now parse the URI Bootstrap::parseURI( getenv( "REQUEST_URI" ), $isRestRequest ); @@ -870,16 +875,16 @@ if (! defined( 'EXECUTE_BY_CRON' )) { $noLoginFiles[] = 'appFolderAjax'; $noLoginFiles[] = 'steps_Ajax'; $noLoginFiles[] = 'proxyCasesList'; - $noLoginFiles[] = 'casesStartPage_Ajax'; - $noLoginFiles[] = 'appProxy'; - $noLoginFiles[] = 'cases_Ajax'; - $noLoginFiles[] = 'casesList_Ajax'; - $noLoginFiles[] = 'proxyReassignCasesList'; - $noLoginFiles[] = 'ajaxListener'; - $noLoginFiles[] = 'cases_Step'; - $noLoginFiles[] = 'cases_ShowOutputDocument'; - $noLoginFiles[] = 'cases_ShowDocument'; - $noLoginFiles[] = 'cases_CatchExecute'; + $noLoginFiles[] = 'casesStartPage_Ajax'; + $noLoginFiles[] = 'appProxy'; + $noLoginFiles[] = 'cases_Ajax'; + $noLoginFiles[] = 'casesList_Ajax'; + $noLoginFiles[] = 'proxyReassignCasesList'; + $noLoginFiles[] = 'ajaxListener'; + $noLoginFiles[] = 'cases_Step'; + $noLoginFiles[] = 'cases_ShowOutputDocument'; + $noLoginFiles[] = 'cases_ShowDocument'; + $noLoginFiles[] = 'cases_CatchExecute'; $noLoginFiles[] = 'cases_SaveData'; $noLoginFolders[] = 'services';