From 77f05c0e331aff84970e2131ed98aec1451f028d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Apr 2012 08:38:48 +0200 Subject: [PATCH] content-length --- htdocs/application/controllers/main.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index 043b8e6..dd3ae8e 100755 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -437,17 +437,24 @@ class Main extends CI_Controller function get_cm_js() { + $this->load->helper('file'); $lang = $this->uri->segment(3); $this->load->config('codemirror_languages'); $cml = $this->config->item('codemirror_languages'); if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array') { - header('Content-Type: application/x-javascript; charset=utf-8'); + $content = ''; + $total_size = 0; foreach ($cml[$lang]['js'] as $js) { - echo file_get_contents('./static/js/' . $js[0]); + $content.= file_get_contents('./static/js/' . $js[0]); + $f = get_file_info('./static/js/' . $js[0]); + $total_size = $total_size + $f['size']; } + header('Content-Type: application/x-javascript; charset=utf-8'); + header('Content-length: ' . $total_size); + echo $content; } } }