+ // Put both together again and let's pray it is secured now...
+ $_SERVER['PHP_SELF'] = $phpSelfDirectory . '/' . $phpSelfFile;
+
+ // Did run...
+ $GLOBALS['php_self_secured'] = TRUE;
+
+ // Remove uneccessary variables
+ unset($phpSelfDirectory);
+ unset($phpSelfFile);
+}
+
+/**
+ * Checks if PHP_VERSION is newer or equal to given version string
+ *
+ * @param $versionString A PHP'ized version string which shall be compared with PHP_VERSION
+ * @return $isEqualNewer Wether the given version string is equal or newer to PHP_VERSION
+ */
+function isPhpVersionEqualNewer ($versionString) {
+ return (version_compare(PHP_VERSION, $versionString, '>='));
+}
+
+/**
+ * Detects caching in PHP
+ *
+ * @return void
+ */
+function detectPhpCaching () {
+ // Activate caching or transparent compressing when it is not already done
+ if ((isPhpVersionEqualNewer('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
+ $GLOBALS['php_caching'] = 'on';
+ ob_start();
+ } else {
+ // Extension not loaded or required function is missing
+ $GLOBALS['php_caching'] = '404';
+ }
+ } else {
+ // Old PHP version
+ $GLOBALS['php_caching'] = 'old';
+ }
+}