equal
deleted
inserted
replaced
80 |
80 |
81 require('includes/functions.php'); |
81 require('includes/functions.php'); |
82 require('includes/json2.php'); |
82 require('includes/json2.php'); |
83 require('includes/js-compressor.php'); |
83 require('includes/js-compressor.php'); |
84 |
84 |
|
85 // try to gzip the output |
|
86 $do_gzip = false; |
|
87 if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) |
|
88 { |
|
89 $acceptenc = str_replace(' ', '', strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])); |
|
90 $acceptenc = explode(',', $acceptenc); |
|
91 if ( in_array('gzip', $acceptenc) ) |
|
92 { |
|
93 $do_gzip = true; |
|
94 ob_start(); |
|
95 } |
|
96 } |
|
97 |
85 // Output format will always be JS |
98 // Output format will always be JS |
86 header('Content-type: text/javascript'); |
99 header('Content-type: text/javascript'); |
87 $everything = ''; |
100 $everything = ''; |
88 |
101 |
89 // Load and parse enano_lib_basic |
102 // Load and parse enano_lib_basic |
175 |
188 |
176 $everything .= "\n // $js_file\n"; |
189 $everything .= "\n // $js_file\n"; |
177 $everything .= "\n" . $file_contents; |
190 $everything .= "\n" . $file_contents; |
178 } |
191 } |
179 |
192 |
|
193 // generate ETag |
|
194 $etag = base64_encode(hexdecode(sha1($everything))); |
|
195 |
|
196 if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) ) |
|
197 { |
|
198 if ( "\"$etag\"" == $_SERVER['HTTP_IF_NONE_MATCH'] ) |
|
199 { |
|
200 header('HTTP/1.1 304 Not Modified'); |
|
201 exit(); |
|
202 } |
|
203 } |
|
204 |
180 $date = date('r', $apex); |
205 $date = date('r', $apex); |
181 header("Date: $date"); |
206 header("Date: $date"); |
182 header("Last-Modified: $date"); |
207 header("Last-Modified: $date"); |
|
208 header("ETag: \"$etag\""); |
183 |
209 |
184 echo $everything; |
210 echo $everything; |
185 |
211 |
|
212 if ( $do_gzip ) |
|
213 { |
|
214 gzip_output(); |
|
215 } |
|
216 |