- // ... and finally cookies
- foreach ($_COOKIE as $seckey=>$secvalue) {
- if (is_array($secvalue)) {
- // Throw arrays away...
- unset($_COOKIE[$seckey]);
- } else {
- // Only variables are allowed (non-array) but we secure them all!
- foreach ($SEC_CHARS['from'] as $key=>$char) {
- // Pass all through
- $_COOKIE[$seckey] = str_replace($char , $SEC_CHARS['to'][$key], $_COOKIE[$seckey]);
- }
-
- // Strip all other out
- $_COOKIE[$seckey] = strip_tags($_COOKIE[$seckey]);
- }
- }
-}
-
-// Activate caching or transparent compressing when it is not already done
-if (!defined('_OB_CACHING')) {
- if (phpversion() >= '4.0.4pl1' && (strstr(getenv('HTTP_USER_AGENT'),'compatible') || (strstr(getenv('HTTP_USER_AGENT'), "Mozilla")))) {
- if ((extension_loaded('zlib')) && (function_exists('ob_start'))) {
- // Start caching
- define('_OB_CACHING', "on");
- ob_start();
- } else {
- // Extension not loaded or required function is missing
- define('_OB_CACHING', "404");
- }
- } else {
- // Old PHP version
- define('_OB_CACHING', "old");
- }
-}