';
+ }
+ }
+ }
+ });
+}
diff -r 4c6da61e613e -r de56132c008d includes/clientside/static/enano-lib-basic.js
--- a/includes/clientside/static/enano-lib-basic.js Sun Mar 28 21:40:37 2010 -0400
+++ b/includes/clientside/static/enano-lib-basic.js Sun Mar 28 21:49:26 2010 -0400
@@ -576,6 +576,7 @@
ajaxCatToTag: 'ajax.js',
ajaxCatEdit: 'ajax.js',
ajaxReverseDNS: 'ajax.js',
+ ajaxGzipCheck: 'ajax.js',
ajaxOpenACLManager: 'acl.js',
ajaxOpenDirectACLRule: 'acl.js',
ajaxAdminPage: 'login.js',
diff -r 4c6da61e613e -r de56132c008d includes/functions.php
--- a/includes/functions.php Sun Mar 28 21:40:37 2010 -0400
+++ b/includes/functions.php Sun Mar 28 21:49:26 2010 -0400
@@ -3215,7 +3215,7 @@
// Compress buffered output if required and send to browser
// Sorry, doesn't work in IE. What else is new?
//
- if ( $do_gzip && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() && $gzip_supported )
+ if ( $do_gzip && getConfig('gzip_output', false) == 1 && function_exists('gzdeflate') && !strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && !headers_sent() && $gzip_supported )
{
$gzip_contents = ob_get_contents();
ob_end_clean();
diff -r 4c6da61e613e -r de56132c008d index.php
--- a/index.php Sun Mar 28 21:40:37 2010 -0400
+++ b/index.php Sun Mar 28 21:49:26 2010 -0400
@@ -24,8 +24,7 @@
// Set up gzip encoding before any output is sent
global $do_gzip;
-// FIXME: make this configurable
-$do_gzip = !defined('ENANO_DEBUG');
+$do_gzip = !defined('ENANO_DEBUG') && getConfig('gzip_output', false) == 1 && !isset($_GET['disable_builtin_gzip']);
error_reporting(E_ALL);
diff -r 4c6da61e613e -r de56132c008d language/english/admin.json
--- a/language/english/admin.json Sun Mar 28 21:40:37 2010 -0400
+++ b/language/english/admin.json Sun Mar 28 21:49:26 2010 -0400
@@ -336,7 +336,7 @@
// Section: default theme
heading_default_theme: 'Visual defaults',
- field_defualt_theme: 'Default theme for guests and new users:',
+ field_default_theme: 'Default theme for guests and new users:',
// Section: breadcrumbs
field_breadcrumb_mode: 'Enable breadcrumbs:',
@@ -345,11 +345,22 @@
field_breadcrumb_mode_never: 'Never',
// Section: CDN
-
field_cdn_path: 'URL to CDN server:',
field_cdn_path_hint: 'A CDN, or Content Delivery Network, allows downloading of shared Enano components from a server designed to serve out only images, CSS, and script files. Since a browser can open separate connections for the page and for images and scripts, the page loads faster. Leave this blank to just use Enano\'s local files (default).',
field_cdn_path_example: 'Example: http://cdn.mycompany.com/enano/',
+ // Section: gzip
+ field_gzip: 'Enable gzip compression',
+ field_gzip_hint: 'Compress pages using before sending them to the user. At the cost of a small amount of CPU, this can save a lot of bandwidth. This only enables compression for HTML and some Javascript; to gzip compress CSS and images, please consult your webserver\'s documentation.',
+ field_gzip_lbl: 'Use gzip compression',
+ field_gzip_btn_check: 'Check server for support',
+ field_gzip_check_msg_server_does_it: 'Your server performs gzip compression on its own. There is no need to enable it in Enano, and if you do, you may cause Enano to stop working.',
+ field_gzip_check_msg_server_good: 'Your server is not automatically compressing PHP-generated pages, so Enano\'s compression facilities are needed.',
+ field_gzip_check_msg_php_bad: 'PHP does not have gzip support enabled.',
+ field_gzip_check_msg_php_good: 'Found gzip compression support in PHP.',
+ field_gzip_check_msg_success: 'Success - all server checks passed. You can enable gzip support.',
+ field_gzip_check_msg_failure: 'Server check failed. Unless you think Enano is wrong, don\'t enable gzip below.',
+
// Main section: users and communication
heading_users: 'Users and communication',
diff -r 4c6da61e613e -r de56132c008d plugins/SpecialAdmin.php
--- a/plugins/SpecialAdmin.php Sun Mar 28 21:40:37 2010 -0400
+++ b/plugins/SpecialAdmin.php Sun Mar 28 21:49:26 2010 -0400
@@ -82,6 +82,41 @@
return;
}
+ // FIXME: is this a bad place for this? I couldn't think of anything much better. Not helped by the fact that I hate misc scripts.
+ if ( isset($_POST['act']) && $_POST['act'] === 'gzip_check' )
+ {
+ global $is_https;
+ header('Content-type: application/json');
+ require(ENANO_ROOT . '/includes/http.php');
+ try
+ {
+ if ( !isset($_SERVER['SERVER_ADDR']) )
+ throw new Exception('No SERVER_ADDR support - can\'t test server environment');
+
+ $server_addr = $_SERVER['SERVER_ADDR'];
+ // cheap ipv6 test
+ if ( strstr($server_addr, ":") )
+ $server_addr = "[$server_addr]";
+
+ $req = new Request_HTTP($server_addr, makeUrlNS('System', 'GzipTest', 'disable_builtin_gzip'), 'GET', intval($_SERVER['SERVER_PORT']), $is_https);
+ $req->add_header('Accept-Encoding', 'gzip,deflate');
+ $headers = $req->get_response_headers_array();
+ $send = array(
+ 'server_does_it' => ( isset($headers['Content-encoding']) && in_array($headers['Content-encoding'], array('gzip', 'deflate')) ),
+ 'php_supports_gzip' => function_exists('gzdeflate')
+ );
+ }
+ catch ( Exception $e )
+ {
+ $send = array(
+ 'mode' => 'error',
+ 'error' => "HTTP request exception: