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:
$e
" + ); + } + echo enano_json_encode($send); + return; + } + if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') ) { @@ -236,6 +271,7 @@ setConfig('avatar_directory', 'files/avatars'); setConfig('userpage_grant_acl', ( isset($_POST['userpage_grant_acl']) ? '1' : '0' )); + setConfig('gzip_output', ( isset($_POST['gzip_output']) ? '1' : '0' )); // Allow plugins to save their changes $code = $plugins->setHook('acp_general_save'); @@ -496,7 +532,7 @@ - get('acpgc_field_defualt_theme'); ?> + get('acpgc_field_default_theme'); ?> /> + get('acpgc_field_gzip_lbl'); ?> + + + + setHook('acp_general_basic');