diff --git a/css/status_config.php b/css/status_config.php index c1c30dd4e0..34ca2f5ae9 100644 --- a/css/status_config.php +++ b/css/status_config.php @@ -28,20 +28,9 @@ # Prevent output of HTML in the content if errors occur define( 'DISABLE_INLINE_ERROR_REPORTING', true ); -$t_allow_caching = isset( $_GET['cache_key'] ); -if( $t_allow_caching ) { - # Suppress default headers. This allows caching as defined in server configuration - $g_bypass_headers = true; -} - @require_once( dirname( dirname( __FILE__ ) ) . '/core.php' ); require_api( 'config_api.php' ); -if( $t_allow_caching ) { - # if standard headers were bypassed, add security headers, at least - http_security_headers(); -} - /** * Send correct MIME Content-Type header for css content. */ @@ -91,6 +80,11 @@ exit; } +# rewrite headers to allow caching +if( gpc_isset( 'cache_key' ) ) { + http_caching_headers( true ); +} + $t_status_string = config_get( 'status_enum_string' ); $t_statuses = MantisEnum::getAssocArrayIndexedByValues( $t_status_string ); $t_colors = config_get( 'status_colors' ); diff --git a/javascript_config.php b/javascript_config.php index 54e9a7acc3..2d6a4bfe4b 100644 --- a/javascript_config.php +++ b/javascript_config.php @@ -27,20 +27,9 @@ # Prevent output of HTML in the content if errors occur define( 'DISABLE_INLINE_ERROR_REPORTING', true ); -$t_allow_caching = isset( $_GET['cache_key'] ); -if( $t_allow_caching ) { - # Suppress default headers. This allows caching as defined in server configuration - $g_bypass_headers = true; -} - require_once( 'core.php' ); require_api( 'config_api.php' ); -if( $t_allow_caching ) { - # if standard headers were bypassed, add security headers, at least - http_security_headers(); -} - /** * Print array of configuration option->values for javascript. * @param string $p_config_key Configuration option. @@ -59,6 +48,10 @@ function print_config_value( $p_config_key ) { # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx header( 'X-Content-Type-Options: nosniff' ); +# rewrite headers to allow caching +if( gpc_isset( 'cache_key' ) ) { + http_caching_headers( true ); +} # WARNING: DO NOT EXPOSE SENSITIVE CONFIGURATION VALUES! # diff --git a/javascript_translations.php b/javascript_translations.php index 0ba521f877..33810623f6 100644 --- a/javascript_translations.php +++ b/javascript_translations.php @@ -28,20 +28,9 @@ # Prevent output of HTML in the content if errors occur define( 'DISABLE_INLINE_ERROR_REPORTING', true ); -$t_allow_caching = isset( $_GET['cache_key'] ); -if( $t_allow_caching ) { - # Suppress default headers. This allows caching as defined in server configuration - $g_bypass_headers = true; -} - require_once( 'core.php' ); require_api( 'lang_api.php' ); -if( $t_allow_caching ) { - # if standard headers were bypassed, add security headers, at least - http_security_headers(); -} - /** * Print Language translation for javascript * @param string $p_lang_key Language string being translated. @@ -60,6 +49,11 @@ function print_translation( $p_lang_key ) { # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx header( 'X-Content-Type-Options: nosniff' ); +# rewrite headers to allow caching +if( gpc_isset( 'cache_key' ) ) { + http_caching_headers( true ); +} + echo "var translations = new Array();\n"; print_translation( 'time_tracking_stopwatch_start' ); print_translation( 'time_tracking_stopwatch_stop' ); diff --git a/plugin.php b/plugin.php index 146811e9f8..8c5ec93755 100644 --- a/plugin.php +++ b/plugin.php @@ -27,22 +27,12 @@ * @uses plugin_api.php */ -$t_allow_caching = isset( $_GET['cache_key'] ); -if( $t_allow_caching ) { - # Suppress default headers. This allows caching as defined in server configuration - $g_bypass_headers = true; -} - require_once( 'core.php' ); require_api( 'config_api.php' ); require_api( 'constant_inc.php' ); require_api( 'gpc_api.php' ); require_api( 'plugin_api.php' ); -if( $t_allow_caching ) { - http_security_headers(); -} - $t_plugin_path = config_get_global( 'plugin_path' ); $f_page = gpc_get_string( 'page' ); @@ -75,5 +65,10 @@ trigger_error( ERROR_PLUGIN_PAGE_NOT_FOUND, ERROR ); } +# rewrite headers to allow caching +if( gpc_isset( 'cache_key' ) ) { + http_caching_headers( true ); +} + plugin_push_current( $t_basename ); include( $t_page );