|
From: Markus P. <mar...@us...> - 2005-04-25 20:50:35
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14283/includes Modified Files: mx_functions.php page_header.php Log Message: Fixed usage of mx_session_start(); Index: page_header.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/page_header.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** page_header.php 19 Apr 2005 23:36:24 -0000 1.18 --- page_header.php 25 Apr 2005 20:50:05 -0000 1.19 *************** *** 29,32 **** --- 29,38 ---- define('HEADER_INC', true); + /********** + NOTE: + + The following code related to GZIP initialization has been moved to + the new mx_session_start() function, declared in mx_functions.php + // // gzip_compression *************** *** 62,65 **** --- 68,72 ---- } } + **********/ // Index: mx_functions.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** mx_functions.php 25 Apr 2005 01:27:20 -0000 1.39 --- mx_functions.php 25 Apr 2005 20:50:04 -0000 1.40 *************** *** 532,535 **** --- 532,600 ---- /********************************************************************************\ + | PHP Sessions Management + | If necessary, GZIP initialization should be done before session_start(). + \********************************************************************************/ + function mx_session_start() + { + global $board_config, $HTTP_SERVER_VARS, $do_gzip_compress; + + // + // Prevent from doing the job more than once. + // + static $_been_here_before = false; + + if ( $_been_here_before ) + { + return; + } + $_been_here_before = true; + + // + // gzip_compression + // + + // + // declared in common.php, just before calling mx_session_start. ;-) + // + // $do_gzip_compress = FALSE; + + if ( $board_config['gzip_compress'] ) + { + $phpver = phpversion(); + + $useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); + + if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) ) + { + if ( extension_loaded('zlib') ) + { + ob_end_clean(); + ob_start('ob_gzhandler'); + } + } + else if ( $phpver > '4.0' ) + { + if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') ) + { + if ( extension_loaded('zlib') ) + { + $do_gzip_compress = TRUE; + ob_start(); + ob_implicit_flush(0); + + header('Content-Encoding: gzip'); + } + } + } + } + + // + // Initialize PHP session + // + session_start(); + + } + + /********************************************************************************\ | Generate icon lists | Snatched frompafilDB |