forked from extern/egroupware
switch zlib.output_compression off, as we cant calculate Content-Length header, if its on, doing our own Content-Encoding: gzip now (wont be necessary for Apache2.2 which fixes false Content-Length headers silently, but eg. Lighttpd cuts off content, if wrong Content-Length header specified
using md5 of real content for instance specific translations, cant use lang_ctimes for them
This commit is contained in:
parent
5b4c2898b1
commit
0f838df1b9
@ -11,6 +11,9 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
|
||||||
|
ini_set('zlib.output_compression', 0);
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = array(
|
$GLOBALS['egw_info'] = array(
|
||||||
'flags' => array(
|
'flags' => array(
|
||||||
'currentapp' => 'home',
|
'currentapp' => 'home',
|
||||||
@ -39,8 +42,16 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
|
|||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'egw.set_configs('.json_encode($config).");\n";
|
$content = 'egw.set_configs('.json_encode($config).");\n";
|
||||||
echo 'egw.set_link_registry('.$link_registry.");\n";
|
$content .= 'egw.set_link_registry('.$link_registry.");\n";
|
||||||
|
|
||||||
|
// we run our own gzip compression, to set a correct Content-Length of the encoded content
|
||||||
|
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
|
||||||
|
{
|
||||||
|
$content = gzencode($content);
|
||||||
|
header('Content-Encoding: gzip');
|
||||||
|
}
|
||||||
|
|
||||||
// Content-Lenght header is important, otherwise browsers dont cache!
|
// Content-Lenght header is important, otherwise browsers dont cache!
|
||||||
Header('Content-Length: '.ob_get_length());
|
Header('Content-Length: '.bytes($content));
|
||||||
|
echo $content;
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
|
||||||
|
ini_set('zlib.output_compression', 0);
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = array(
|
$GLOBALS['egw_info'] = array(
|
||||||
'flags' => array(
|
'flags' => array(
|
||||||
'currentapp' => 'home',
|
'currentapp' => 'home',
|
||||||
@ -21,10 +24,10 @@ $GLOBALS['egw_info'] = array(
|
|||||||
|
|
||||||
include '../header.inc.php';
|
include '../header.inc.php';
|
||||||
|
|
||||||
$image_map = common::image_map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null);
|
$content = common::image_map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null);
|
||||||
|
|
||||||
// use an etag over the image mapp
|
// use an etag over the image mapp
|
||||||
$etag = '"'.md5(serialize($image_map)).'"';
|
$etag = '"'.md5(serialize($content)).'"';
|
||||||
|
|
||||||
// headers to allow caching
|
// headers to allow caching
|
||||||
Header('Content-Type: text/javascript; charset=utf-8');
|
Header('Content-Type: text/javascript; charset=utf-8');
|
||||||
@ -39,7 +42,15 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
|
|||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'egw.set_images('.json_encode($image_map).");\n";
|
$content = 'egw.set_images('.json_encode($content).");\n";
|
||||||
|
|
||||||
|
// we run our own gzip compression, to set a correct Content-Length of the encoded content
|
||||||
|
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
|
||||||
|
{
|
||||||
|
$content = gzencode($content);
|
||||||
|
header('Content-Encoding: gzip');
|
||||||
|
}
|
||||||
|
|
||||||
// Content-Lenght header is important, otherwise browsers dont cache!
|
// Content-Lenght header is important, otherwise browsers dont cache!
|
||||||
Header('Content-Length: '.ob_get_length());
|
Header('Content-Length: '.bytes($content));
|
||||||
|
echo $content;
|
@ -15,6 +15,9 @@
|
|||||||
if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!');
|
if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!');
|
||||||
if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!');
|
if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!');
|
||||||
|
|
||||||
|
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
|
||||||
|
ini_set('zlib.output_compression', 0);
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = array(
|
$GLOBALS['egw_info'] = array(
|
||||||
'flags' => array(
|
'flags' => array(
|
||||||
'currentapp' => in_array($_GET['app'],array('etemplate','common','custom')) ? 'home' : $_GET['app'],
|
'currentapp' => in_array($_GET['app'],array('etemplate','common','custom')) ? 'home' : $_GET['app'],
|
||||||
@ -27,7 +30,19 @@ $GLOBALS['egw_info'] = array(
|
|||||||
include '../header.inc.php';
|
include '../header.inc.php';
|
||||||
|
|
||||||
// use an etag with app, lang and a hash over the creation-times of all lang-files
|
// use an etag with app, lang and a hash over the creation-times of all lang-files
|
||||||
|
if (!in_array($_GET['app'], translation::$instance_specific_translations))
|
||||||
|
{
|
||||||
$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.md5(serialize($GLOBALS['egw_info']['server']['lang_ctimes'])).'"';
|
$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.md5(serialize($GLOBALS['egw_info']['server']['lang_ctimes'])).'"';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
translation::add_app($_GET['app'], $_GET['lang']);
|
||||||
|
if (!count(translation::$lang_arr))
|
||||||
|
{
|
||||||
|
translation::add_app($_GET['app'], 'en');
|
||||||
|
}
|
||||||
|
$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.md5(serialize(translation::$lang_arr));
|
||||||
|
}
|
||||||
|
|
||||||
// headers to allow caching of one month
|
// headers to allow caching of one month
|
||||||
Header('Content-Type: text/javascript; charset=utf-8');
|
Header('Content-Type: text/javascript; charset=utf-8');
|
||||||
@ -42,13 +57,24 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
|
|||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!in_array($_GET['app'], translation::$instance_specific_translations))
|
||||||
|
{
|
||||||
translation::add_app($_GET['app'], $_GET['lang']);
|
translation::add_app($_GET['app'], $_GET['lang']);
|
||||||
if (!count(translation::$lang_arr))
|
if (!count(translation::$lang_arr))
|
||||||
{
|
{
|
||||||
translation::add_app($_GET['app'], 'en');
|
translation::add_app($_GET['app'], 'en');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo 'egw.set_lang_arr("'.$_GET['app'].'", '.json_encode(translation::$lang_arr).');';
|
$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.json_encode(translation::$lang_arr).');';
|
||||||
|
|
||||||
|
// we run our own gzip compression, to set a correct Content-Length of the encoded content
|
||||||
|
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
|
||||||
|
{
|
||||||
|
$content = gzencode($content);
|
||||||
|
header('Content-Encoding: gzip');
|
||||||
|
}
|
||||||
|
|
||||||
// Content-Lenght header is important, otherwise browsers dont cache!
|
// Content-Lenght header is important, otherwise browsers dont cache!
|
||||||
Header('Content-Length: '.ob_get_length());
|
Header('Content-Length: '.bytes($content));
|
||||||
|
echo $content;
|
||||||
|
Loading…
Reference in New Issue
Block a user